Sample
pyint-ba1d7915da57-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.019 | 0–1; higher is more readable |
| Dorn | 0.486 | 0–1; higher is more readable |
| Mi | 0.481 | 0–1; higher is more readable |
| LLOC | 6 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 13.67 | 0–20; mean of three runs |
| BTTF | 0.708 | 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.881 | −7.321 |
| Source linesThe number of non-empty source lines. | 14 | +5.6 |
Intercept 8.87 + feature contributions = -3.941 (log-odds).
Score = sigmoid(-3.941) = 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.793 | −0.217 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.096 | +0.01 |
Intercept 0.07 + feature contributions = -0.057 (log-odds).
Score = sigmoid(-0.057) = 0.486.
| Score | 0.481 |
|---|
| Score | 6 |
|---|
Run 1
The code is well-structured and readable. Imports are organized, with clear separation between standard library and typing. Type aliases and Protocol usage are modern and explicit, showing clear intent for a generic mapping protocol. Nesting is minimal — only a single class with one method. The only issue is a typo 'ite' instead of 'items', which harms clarity. Otherwise, the code is concise, flat, and follows natural reading flow.
Run 2
The code is highly readable due to its clear structure and logical organization. It uses modern Python typing features with explicit imports from __future__ and collections.abc, making intent clear. The Protocol class with runtime_checkable is concise and well-defined. However, there is a minor typo in the method name 'ite' instead of 'items', which slightly affects clarity of intent. Overall, the code is concise, flat, and follows natural reading flow with one action per line, making it easy to understand for developers familiar with Python typing.
Run 3
The code is highly readable with a clear, logical structure. Imports are grouped by standard library and typing modules, following common Python conventions. The use of `from __future__ import annotations` and `Protocol` with `TypeVar`/`TypeAlias` shows modern, type-safe design. Nesting is minimal except for the protocol method signature, which is necessary. The intent is transparent: defining a runtime-checkable protocol for objects that provide an `ite` method returning key-value pairs. The code is concise with no unnecessary length, and each line performs a single logical action. The reading flow is natural, moving from imports to the protocol definition. Minor deductions: the method name `ite` may be a typo for `items`, which slightly harms clarity, and the `TypeVar` names `_KT_co`/`_VT_co` are standard but could be more descriptive for novices.
Run 1
Code Structure: Imports and the protocol declaration are logically organized, but the type variables are not defined in the snippet and several imports are unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems suggests an items interface, but the method name ite is unclear and inconsistent with that expectation. Code length: The declaration is concise, though the import list adds unnecessary bulk for the code shown. Action granularity: Each line generally has a single purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The imports-to-declaration sequence is natural, but undefined type variables and the ambiguous method name interrupt comprehension.
Run 2
Code Structure: Imports and the protocol declaration are logically organized, although several imports are unused. Nesting: The code is shallow and easy to scan. Clarity of intent: Type annotations suggest a protocol for iterable key-value pairs, but the method name 'ite' is unclear and conflicts with the name 'SupportsItems'. The undeclared type variables _KT_co and _VT_co further obscure the definition. Code length: The snippet is concise, though unused imports add unnecessary clutter. Action granularity: Each statement has a single purpose; the inline ellipsis is conventional for a protocol method. Reading flow: The progression from imports to decorator to class is natural, but missing type-variable definitions interrupt understanding.
Run 3
Code Structure: Imports and a single protocol class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: The protocol and return annotation suggest an item-producing interface, but the unexplained method name 'ite' conflicts with 'SupportsItems', and _KT_co and _VT_co are not defined in the snippet. Code length: Compact overall, although unused imports add clutter. Action granularity: Each statement has a single purpose; the inline ellipsis is conventional for a protocol method. Reading flow: Imports naturally precede the declaration, but missing type-variable definitions interrupt understanding.