Sample
pyint-892676ac1bea-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.019 | 0–1; higher is more readable |
| Dorn | 0.487 | 0–1; higher is more readable |
| Mi | 0.483 | 0–1; higher is more readable |
| LLOC | 6 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 18 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.33 | 0–20; mean of three runs |
| BTTF | 0.706 | 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. | 336.045 | −11.089 |
| 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.879 | −7.318 |
| Source linesThe number of non-empty source lines. | 14 | +5.6 |
Intercept 8.87 + feature contributions = -3.938 (log-odds).
Score = sigmoid(-3.938) = 0.019.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 15 | +0.505 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 14 | −0.253 |
| 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. | 81 | +0.234 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 13.78 | −0.217 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.095 | +0.015 |
Intercept 0.07 + feature contributions = -0.052 (log-odds).
Score = sigmoid(-0.052) = 0.487.
| Score | 0.483 |
|---|
| Score | 6 |
|---|
Run 1
The code is highly readable. It clearly separates imports by standard library and typing, uses `__future__` for modern features, and defines a concise, runtime-checkable protocol with clear intent. The structure is logical and flat, with minimal nesting and one action per line. The only minor issue is the use of a single-letter variable names (`_KT_co`, `_VT_co`), which is conventional in generic typing but may slightly reduce immediate clarity for some readers. Overall, it is concise, well-organized, and easy to follow.
Run 2
The code is highly readable. It has a clear and logical structure, with imports organized from `__future__` and standard library modules into grouped typing imports. Nesting is flat, and the `Protocol` class defines a single method with a clear purpose. The use of type variables and `runtime_checkable` indicates intent, though the single method `route` is slightly ambiguous without additional context—'items' might be more typical than 'route'. The code is concise and avoids unnecessary length, with one declaration per line. Reading flow is natural, moving from imports to the protocol definition. Minor deductions are for the ambiguous method name and the slight verbosity of the type aliases.
Run 3
The code is clean and readable. It uses modern Python typing features (Protocol, TypeVar, runtime_checkable) logically and groups imports clearly by origin (future, collections.abc, typing). The structure is well-organized with no unnecessary nesting. The protocol class has a single, clear purpose—defining a callable interface returning key-value iterables—though the method name 'route' is slightly ambiguous given the protocol name 'SupportsItems'. Naming aside, the intent is reasonably clear for a typing-focused module. The code is concise, with no redundant lines, and each import or definition occupies its own line, maintaining good action granularity. Reading flow is natural: module-level imports, then type definitions, then the protocol. Minor deductions: the method name could better reflect items-related behavior, and the use of both `collections.abc` and `typing` imports for similar purposes slightly adds cognitive overhead. Overall, it is highly readable for an experienced Python developer, particularly one familiar with static typing and generics.
Run 1
Code Structure: Imports and the protocol definition are logically organized, though several imports are unused and the type variables are undefined in the snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: The typed protocol is understandable, but SupportsItems suggests an items() interface rather than route(), creating ambiguity. Code length: The implementation is concise, although the import list is disproportionate to the code shown. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for protocol methods. Reading flow: Generally natural from imports to interface, but undefined type variables and inconsistent naming interrupt comprehension.
Run 2
Code Structure: Imports and the protocol declaration are logically organized, but several imports are unused and the generic type variables are not defined in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Protocol and type annotations communicate an interface, but SupportsItems suggests an items() method rather than route(), creating ambiguity. Code length: The implementation is concise, although unnecessary imports add clutter. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The progression from imports to decorator to class is natural, but missing type-variable definitions and the naming mismatch interrupt understanding.
Run 3
Code Structure: Imports and the protocol declaration are logically organized, but several imports are unused and the type variables are not defined in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The protocol and return annotation suggest key-value iteration, but SupportsItems implies an items() method rather than route(), creating ambiguity. Code length: The implementation is concise, though the unused imports add clutter. Action granularity: Each statement has a clear role; the inline ellipsis is conventional for protocol methods. Reading flow: The top-to-bottom flow is natural, but undefined type variables and inconsistent naming interrupt understanding.