Sample
pyint-026ea9800389-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.792 | 0–1; higher is more readable |
| Mi | 0.435 | 0–1; higher is more readable |
| LLOC | 21 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 12.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14 | 0–20; mean of three runs |
| BTTF | 0.257 | 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. | 824.372 | −27.204 |
| Source linesThe number of non-empty source lines. | 39 | +15.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.597 | −6.895 |
Intercept 8.87 + feature contributions = -9.63 (log-odds).
Score = sigmoid(-9.63) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 69.9 | +0.705 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.036 | +0.59 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 40 | −0.38 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 28 | +0.231 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 28 | −0.222 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 62.75 | +0.208 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 38.915 | +0.134 |
Intercept 0.07 + feature contributions = 1.336 (log-odds).
Score = sigmoid(1.336) = 0.792.
| Score | 0.435 |
|---|
| Score | 21 |
|---|
Run 1
The code is highly readable with clear structure, minimal nesting, and explicit intent. Class and method names are descriptive, type hints are used consistently, and comments clarify non-obvious behavior like the limitation of the `new` attribute. The `on_update` callback is appropriately granular, though it contains a somewhat unrelated loop example (summing 1-5) that slightly obscures its purpose. Overall, the code follows good Python practices.
Run 2
The code has a clear class structure and good documentation, but contains several issues. The import section mixes multiple import styles (from __future__, standard library, third-party). The on_update callback contains an unrelated loop (running_total calculation) that serves no purpose and obscures intent. While nesting is shallow and action granularity is acceptable, the meaningless loop breaks reading flow and clarity. Type hints are used well, but 'te.Self' is undefined in the visible import list. The code length is reasonable, and the overall layout is organized, but the confusing loop and undefined type reference reduce readability significantly. The documentation is helpful for understanding the class purpose.
Run 3
The code has a clear class definition and docstring, but the overall flow is disrupted by an unrelated loop inside the on_update callback. The loop appears to be placeholder logic that obscures the intent ('mark modified when updated') and adds unnecessary nesting and length. Type annotations are helpful, but imports are inconsistent—mixing aliased and direct imports (c vs. collections.abc) reduces clarity. The use of 'te.Self' is undefined in this context, which would break understanding. Action granularity is mixed: the loop combines multiple arithmetic actions in one line, while other parts are one action per line. Structure is logical but cluttered by the irrelevant loop. Nesting is moderate, but the loop introduces needless depth. Overall readability suffers due to ambiguous intent and extraneous code, despite a clean class layout.
Run 1
Code Structure: The class and update callback are logically organized, but unrelated computation and unused imports introduce clutter. Nesting: Depth is modest, with a callback inside the constructor and a short loop inside it. Clarity of intent: The class docstring and modified-flag comment explain session behavior well, but running_total serves no visible purpose, and SessionMixin and te.Self are undefined in the snippet. Code length: The implementation is short, although the unused loop and verbose constructor formatting add unnecessary length. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Imports, documentation, state, and initialization follow a natural order, but the irrelevant summation interrupts the callback's otherwise straightforward purpose.
Run 2
Code Structure: The class, initializer, and update callback are logically organized, but unused imports and unrelated calculation introduce clutter. Nesting: The callback and its loop create moderate nesting, although the snippet remains easy to follow. Clarity of intent: The docstring, attribute documentation, and callback assignment clearly explain modification tracking; however, the unused running_total calculation obscures the callback's purpose, and SessionMixin and te.Self lack visible definitions or imports. Code length: Documentation is useful, but the unnecessary loop and unused imports make the snippet longer than needed. Action granularity: Each statement performs one action, with consistent formatting. Reading flow: The progression from class documentation to state and initialization is natural, but irrelevant arithmetic interrupts the otherwise straightforward update logic.
Run 3
Code Structure: Imports, class documentation, state, and initialization are logically organized, although several imports are unused and SessionMixin and te are undefined in the snippet. Nesting: The callback inside the constructor and its loop introduce modest nesting. Clarity of intent: Documentation clearly explains modification tracking, but the unused running_total calculation obscures the callback's simple purpose. Code length: The implementation is short, yet the unrelated loop and unused imports add unnecessary length. Action granularity: Each statement performs one action, with no compressed multi-operation lines. Reading flow: Conventional formatting and descriptive names support natural reading, but the unexplained arithmetic interrupts the flow before setting modified.