Sample
pyint-521c60ebc0c2-I12
Inline all eligible single-use intermediate local variables
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 | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.67 | 0–20; mean of three runs |
| BTTF | 0.693 | 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.883 | −7.325 |
| Source linesThe number of non-empty source lines. | 14 | +5.6 |
Intercept 8.87 + feature contributions = -3.944 (log-odds).
Score = sigmoid(-3.944) = 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 concise, well-structured, and purpose-driven. It uses a clear Protocol definition with runtime checkability, proper generic type variables, and a self-explanatory method signature. Imports are organized and minimal, with future annotations for compatibility. Nesting is absent, and action granularity is one concept per line. The only minor drawbacks are reliance on implicit conventions (underscore naming for type vars) and slight verbosity in import grouping, which could affect beginners.
Run 2
The code is a clean, well-organized import block and a concise protocol definition. It uses modern Python conventions (e.g., `from __future__ import annotations`, `TypeAlias`, `Protocol`) with clear intent. The structure is flat, with no nesting or multiple actions per line. Length is minimal and purposeful. The import grouping separates standard library, typing, and runtime constructs cleanly. Minor deductions: the import list is slightly long, and the protocol’s purpose could be more explicit with a docstring or name, but overall readability is high.
Run 3
The code is clean, well-structured, and highly readable. It clearly imports only necessary components, groups imports logically, and defines a single protocol with a clear purpose. The use of TypeVars (_KT_co, _VT_co) appropriately signals covariant key/value types, and the Protocol is straightforward. Nesting is minimal, the code length is concise, and each line maps to a single logical action. The reading flow is natural: future import first, then standard library imports, then typing-related imports, followed by the runtime_checkable protocol definition. Slight deductions are for the long import block and the need for readers to understand advanced typing features like Protocol, TypeAlias, and runtime_checkable, which may slightly obscure intent for less experienced Python developers.
Run 1
Code Structure: Imports and the protocol declaration are logically organized, although the type variables _KT_co and _VT_co are not defined in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems and its typed items method clearly describe an interface for iterable key-value pairs, but unexplained type variables and several unused imports add ambiguity. Code length: The implementation is concise, though imports could be reduced. Action granularity: Each line serves a distinct purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The progression from imports to decorator, class, and method is natural, but missing type-variable declarations interrupt comprehension.
Run 2
Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsItems, the items method, and its return annotation clearly describe an interface for iterable key-value pairs, although _KT_co and _VT_co are not defined in the shown code. Code length: The implementation is concise, but several unused imports add clutter. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for a protocol method. Reading flow: The progression from imports to decorator to class is natural, though additional spacing before the class and visible type-variable definitions would improve readability.
Run 3
Code Structure: Imports followed by a decorated protocol form a logical organization. Nesting: Minimal nesting keeps the snippet easy to scan. Clarity of intent: SupportsItems and its typed items method clearly describe an interface, although _KT_co and _VT_co are undefined in the shown code, and several imports are unused. Code length: The protocol definition is concise, but unnecessary imports add 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 interface definition is natural, though an additional blank line before the top-level class would improve formatting.