Sample
pyint-a651a5d68aa5-I09
Select one of ten low-readability unrelated code templates per class
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.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16.33 | 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 well-structured type-checking boilerplate. It uses clear imports, meaningful Protocol definition, and proper TypeVars. Nesting is flat and action granularity is reasonable. The intent is clear: define a runtime-checkable protocol for objects supporting .items(). The code is concise but could benefit from a docstring explaining the protocol's purpose and constraints.
Run 3
The code is highly readable. It has a clear, logical structure with standard import grouping and alphabetical ordering. Nesting is minimal. The intent is unambiguous: defining a runtime-checkable Protocol for objects with an `.items()` method. The code is concise, with one import per line and a single, well-defined class method. Action granularity is appropriate—each import and the method declaration are on separate lines. The reading flow is natural, following typical Python conventions. The only minor deduction is the use of advanced typing features (TypeVar aliases `_KT_co`, `_VT_co`) that might require familiarity, but the naming clearly indicates key/value covariance.
Run 1
Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsItems clearly describes an interface for objects exposing items(), and its return annotation is informative; however, _KT_co and _VT_co are not defined in the provided snippet, obscuring the generic parameters. Code length: The declaration is concise, though several imports are unused in this excerpt and add clutter. Action granularity: Each statement has a distinct purpose, and the inline ellipsis is conventional for a protocol method. Reading flow: The progression from imports to decorator to interface is natural, but an additional blank line before the class and visible type-variable definitions would improve readability.
Run 2
Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal, with only one method inside the class. Clarity of intent: SupportsItems and its typed items method clearly describe the intended interface, although _KT_co and _VT_co are not defined in the snippet. Code length: The implementation is concise, but several imports are unused here. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The code proceeds naturally from imports to interface definition, though missing type-variable declarations and limited spacing before the class slightly reduce readability.
Run 3
Code Structure: Imports followed by a protocol declaration provide logical organization, although several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems and its typed items method clearly describe the interface, but _KT_co and _VT_co are not defined in the provided code, making the generic parameters harder to understand. Code length: The implementation is concise, though the unused imports add unnecessary length. Action granularity: Each statement has a distinct purpose; the inline ellipsis is a conventional protocol-method stub. Reading flow: The progression from imports to interface is natural, but missing type-variable definitions and limited spacing before the top-level declaration slightly disrupt readability.