Sample
pyint-ae95fd5b80cc-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.741 | 0–1; higher is more readable |
| Mi | 0.384 | 0–1; higher is more readable |
| LLOC | 35 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.621 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 1363.068 | −44.981 |
| Source linesThe number of non-empty source lines. | 49 | +19.6 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.517 | −6.776 |
Intercept 8.87 + feature contributions = -23.287 (log-odds).
Score = sigmoid(-23.287) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 46 | +0.854 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 50 | −0.734 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 46 | −0.635 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.053 | +0.427 |
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 76.94 | +0.406 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.88 | +0.388 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 48.846 | +0.273 |
Intercept 0.07 + feature contributions = 1.049 (log-odds).
Score = sigmoid(1.049) = 0.741.
| Score | 0.384 |
|---|
| Score | 35 |
|---|
Run 1
The code is generally well-structured and readable. It has clear imports, a single class with a focused purpose, and appropriate type hints. The nesting is minimal, with only one if-else block inside a method. The docstrings explain intent well. Action granularity is mostly good—one logical operation per line. Reading flow is natural, with the class defined top-down and methods in a logical order. Minor deductions: the `raise_any` method mixes environment-specific branching (Python version check) inside the error-raising logic, which slightly complicates intent. The `__enter__` method with only `pass` is a bit verbose for what it does. Overall, this is clean, maintainable code with clear purpose and good separation of concerns, but not perfect due to minor complexity in the error grouping logic.
Run 2
The code is generally well-structured with clear intent and good use of type hints. Imports are organized, and the class has a focused responsibility. The context manager methods are concise, and docstrings explain non-obvious behavior. Reading flow is natural. Minor deductions: the `raise_any` method mixes error handling logic with version-specific branching, slightly reducing clarity; the `# noqa: F821` comment signals a potential linting suppression needing explanation. The `__enter__` method with only `pass` is a minor code-length concern, though acceptable for the pattern. Overall, it's readable but not exemplary due to the version-conditional complexity.
Run 3
The code is clean, well-structured, and highly readable. It uses clear imports, type hints, and a focused class with a single responsibility. The context manager methods are short, with minimal nesting and one action per line. Docstrings explain intent, and the conditional error raising is straightforward. Minor deduction for the no-longer-necessary sys.version_info check (BaseExceptionGroup exists in Python 3.11+) and slight verbosity in imports, but overall readability is excellent.
Run 1
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, although many imports are unused in this snippet. Nesting: Shallow overall, with only a small nested conditional in raise_any. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain error collection and deferred raising; returning True implicitly suppresses exceptions and requires familiarity with context managers. Code length: The implementation is concise, but the extensive import block adds clutter relative to the class. Action granularity: Each line generally performs one action, making operations easy to follow. Reading flow: Methods follow the natural context-manager lifecycle, followed by reporting collected errors. Consistent formatting and spacing support readability.
Run 2
Code Structure: The class cleanly separates initialization, context-manager behavior, and deferred error raising, although many imports are unrelated to this snippet. Nesting: Control flow is shallow, with only two conditional levels in raise_any. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain error collection and suppression. Code length: The implementation is concise, but the extensive import block adds visual overhead. Action granularity: Each line performs a single clear action. Reading flow: Methods follow a natural lifecycle from initialization through entry, exit, and error reporting. The version-dependent exception handling is straightforward, though returning True unconditionally and raising only the first error on older Python versions require some attention.
Run 3
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, although many imports are unused in this snippet. Nesting: Control flow is shallow; only raise_any introduces two levels of conditionals. Clarity of intent: Descriptive names, type annotations, and docstrings clearly explain error collection and deferred raising. Code length: The implementation is concise, but the extensive import block is disproportionate to the shown functionality. Action granularity: Each statement performs a single action, and the multiline signature remains easy to scan. Reading flow: Methods follow the natural context-manager lifecycle, with whitespace separating responsibilities. The version-dependent exception handling is straightforward, though its differing behavior across Python versions requires a little interpretation.