Sample

pyint-dd14208a86fb-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines14

Scores

MethodScoreScale
Posnett0.0230–1; higher is more readable
Dorn0.4590–1; higher is more readable
Mi0.5140–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro11.670–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.6590–1; higher is more readable

Views

Source code

from __future__ import annotations from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence from typing import ( TYPE_CHECKING, Any, Protocol, TypeAlias, TypeVar, runtime_checkable, ) @runtime_checkable class SupportsRead(Protocol[_T_co]): def rea(self, len: int = ..., /) -> _T_co: ...

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.330.619−10.91
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.863−7.294
Source linesThe number of non-empty source lines.14+5.6

Intercept 8.87 + feature contributions = -3.735 (log-odds).
Score = sigmoid(-3.735) = 0.023.

Feature contributions

FeatureValueContribution
(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.805−0.217
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.107−0.098

Intercept 0.07 + feature contributions = -0.165 (log-odds).
Score = sigmoid(-0.165) = 0.459.

Score0.514
Score6
Run 1

The code is generally readable with clean imports and logical structure. It uses modern Python typing features appropriately. However, there's a critical bug: `rea` should be `read`, making the intent ambiguous. The nesting is flat, and the code is concise, but the typo undermines clarity of intent and correctness. Overall readability is good but the error prevents it from being higher.

Run 2

The code is generally clear in structure and intent at a high level: imports are organized, and a protocol class is defined with a runtime checkable decorator. However, there are notable issues. The method 'rea' is misspelled, which severely impacts clarity and suggests the code is not ready for use. The use of `len` as a parameter name shadows the built-in `len`, which is poor practice. The protocol is over-engineered for a single method—using a TypeVar for covariance is appropriate but possibly unnecessary for such a simple example. Nesting is minimal, and the code is concise, but the ambiguity in the method name and the shadowing of a built-in reduce readability. The overall structure is logical, but the specific naming flaws and possible over-generalization undermine confidence in the code's clarity.

Run 3

The code is syntactically valid and demonstrates modular organization with clear imports and type hints, but its readability is hampered by several issues. First, there is a likely typo in the method name 'rea' instead of 'read', making the intent ambiguous. Second, the protocol class uses an unconventional and confusing parameter name 'len' which shadows a built-in function, further obscuring clarity. While the structure is flat and concise, the inclusion of a large number of imported types (many of which are unused) adds unnecessary clutter, reducing overall readability. The generic type variable and runtime_checkable decorator are appropriate, but for a snippet this small, the heavy import block outweighs the actual logic. In summary, the code is technically clean but suffers from poor naming choices and visual noise from over-importing, making it less readable than it could be.

Run 1

Code Structure: Imports and the protocol declaration are logically organized, though many imports are unused. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsRead and Protocol suggest a readable-object interface, but the method name 'rea' is ambiguous, 'len' shadows a built-in, and _T_co is not defined in the shown code. Code length: The implementation is concise, although unused imports add clutter. 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 unexplained typing details interrupt understanding.

Run 2

1. Code Structure: Imports and the protocol declaration are logically organized, but _T_co is undefined and many imports are unused. 2. Nesting: Very shallow, with only a method inside a class. 3. Clarity of intent: SupportsRead and Protocol suggest a readable-object interface, but rea appears to be a typo, and len shadows a built-in, weakening clarity. 4. Code length: The implementation is concise, though unused imports add unnecessary bulk. 5. Action granularity: Each declaration occupies its own line; the inline ellipsis is conventional for protocol methods. 6. Reading flow: The imports-to-class progression is natural, but the undefined type variable and naming inconsistencies interrupt comprehension.

Run 3

Code Structure: Imports and a protocol declaration are logically organized, although several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The protocol suggests a readable interface, but the method name 'rea' is ambiguous, '_T_co' is undefined in the shown code, and the parameter name 'len' shadows a built-in. Code length: The declaration is concise, but the import list is disproportionately large for the functionality shown. Action granularity: Each statement serves a single purpose; the one-line method stub is conventional for protocols. Reading flow: The imports, decorator, class, and method follow a natural sequence, though missing spacing before the class and unclear identifiers slightly disrupt readability.