Sample
pyint-5f37f6737ce2-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.734 | 0–1; higher is more readable |
| Mi | 0.526 | 0–1; higher is more readable |
| LLOC | 41 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs |
| BTTF | 0.397 | 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. | 1561.871 | −51.542 |
| Source linesThe number of non-empty source lines. | 55 | +22 |
| 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.48 | −6.719 |
Intercept 8.87 + feature contributions = -27.391 (log-odds).
Score = sigmoid(-27.391) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Indentation frequencyHow rapidly indentation changes from line to line. | 52 | +1.061 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 56 | −0.946 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 52 | −0.772 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.051 | +0.446 |
| 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.929 | +0.407 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.214 | +0.393 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 54.846 | +0.357 |
Intercept 0.07 + feature contributions = 1.016 (log-odds).
Score = sigmoid(1.016) = 0.734.
| Score | 0.526 |
|---|
| Score | 41 |
|---|
Run 1
The code is generally readable and well-structured. It uses type hints, docstrings, and clear naming conventions (e.g., `_CollectErrors`, `raise_any`, `exc_type`). The `__exit__` method is flat and straightforward, with one action per line. The `raise_any` method also has clear intent. However, there are a few minor issues: the Fibonacci sequence code in `__init__` is irrelevant to the class purpose and adds unnecessary length and confusion. Additionally, the conditional raise in `raise_any` could be slightly clearer with a helper method or explicit comment, though it is acceptable. Overall, the code is clean and easy to follow, but the unrelated computation and minor verbosity prevent a higher score.
Run 2
The code is generally clear, with a descriptive class name, docstrings, and type hints. However, it contains an unrelated Fibonacci calculation in the constructor that serves no purpose and harms readability by obscuring intent. The __exit__ method is flat and simple, and action granularity is reasonable. The nesting is shallow and the flow is logical overall, but the extraneous loop is distracting. The raise_any method is concise and clear. Overall, the code is readable but would improve significantly if unrelated logic were removed.
Run 3
The code is difficult to read due to several issues. The _CollectErrors class contains an unnecessary Fibonacci calculation in __init__ that serves no purpose and confuses the intent. The class has weak cohesion: it mixes error collection with unrelated logic. __enter__ returns None instead of self, breaking context manager conventions. The __exit__ method has multiple actions per line combined with complex type annotations. The use of BaseExceptionGroup inside a conditional with a noqa comment adds cognitive overhead. The overall structure lacks clarity—imports are disorganized, and method purposes are obscured by poor naming and placement. The code violates single-responsibility and clean code principles, making it harder to understand than necessary.
Run 1
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, but numerous unused imports add clutter. Nesting: Mostly shallow, with only modest nesting in raise_any. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection and deferred raising. However, the unused Fibonacci-style calculation in __init__ is unrelated to that purpose and creates confusion. Code length: The functional implementation is concise, but unnecessary imports and computation inflate the snippet. Action granularity: Each line generally performs a single action, making individual statements easy to follow. Reading flow: The method order naturally follows the context-manager lifecycle, although the irrelevant initialization loop interrupts that flow.
Run 2
Code Structure: The context manager is logically organized into initialization, entry, exit, and error reporting, but numerous unused imports add clutter. Nesting: Mostly flat, with only modest nesting in raise_any. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection; however, the unrelated Fibonacci-like loop in __init__ is unexplained and obscures initialization. Code length: The core implementation is concise, but the unused imports and pointless loop unnecessarily lengthen it. Action granularity: Each statement generally performs one action, making individual lines easy to follow. Reading flow: The lifecycle methods appear in a natural order, and version-dependent exception handling is straightforward, but irrelevant setup distracts from the main purpose.
Run 3
Code Structure: The context-manager methods are logically organized, but many unused imports and an unrelated Fibonacci-style loop in __init__ add clutter. Nesting: Mostly shallow, with only modest nesting in raise_any. Clarity of intent: The class docstring, method names, and type annotations clearly explain error collection and deferred raising; the unexplained loop undermines that clarity. Code length: The core implementation is concise, but unnecessary imports and calculations inflate it. Action granularity: Statements generally perform one action per line, making operations easy to follow. Reading flow: The progression from initialization to context entry, exception collection, and deferred raising is natural, though the irrelevant initialization work interrupts it.