Sample
pyint-55bfc8bb8b5a-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.006 | 0–1; higher is more readable |
| Dorn | 0.478 | 0–1; higher is more readable |
| Mi | 0.427 | 0–1; higher is more readable |
| LLOC | 6 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12.33 | 0–20; mean of three runs |
| BTTF | 0.68 | 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.872 | −7.309 |
| Source linesThe number of non-empty source lines. | 11 | +4.4 |
Intercept 8.87 + feature contributions = -5.128 (log-odds).
Score = sigmoid(-5.128) = 0.006.
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. | 12 | +0.611 |
| 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. | 11 | −0.357 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 10.695 | −0.26 |
| 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 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.095 | +0.02 |
Intercept 0.07 + feature contributions = -0.087 (log-odds).
Score = sigmoid(-0.087) = 0.478.
| Score | 0.427 |
|---|
| Score | 6 |
|---|
Run 1
The code is highly readable due to its clear structure and logical organization. Imports are grouped properly, with future annotations, standard library, and typing imports separated. The use of Protocol and TypeVars is concise and idiomatic for Python typing. Nesting is minimal, and the class definition is flat with a single method. The intent of defining a runtime-checkable protocol for items() is evident. The typing imports are slightly over-multiline but acceptable for clarity. Action granularity is appropriate—each import or declaration stands alone. Reading flow is natural. Minor deductions: the multi-line import could be more compact, and the ellipsis-only body is sparse but standard for protocols.
Run 2
The code is relatively short and logically organized, returning a single data structure. However, the readability is significantly hindered by a disorganized import section where multiple modules are unnecessarily placed on separate lines within parentheses, breaking the natural flow. There is also inconsistent import ordering: 'TYPE_CHECKING' and 'Any' are mixed with Protocol, TypeAlias, TypeVar, and runtime_checkable without clear grouping. The Protocol definition and method signature are clear, but the use of type variables (_KT_co, _VT_co) without context could be ambiguous for readers unfamiliar with generic Protocols. Nesting is minimal, and the action granularity is appropriate. Overall, it is functional but the import formatting and lack of consistent organization reduce clarity and reading flow.
Run 3
The code is highly readable with clear structure and minimal nesting. Imports are logically grouped, and the Protocol class outlines intent well. However, the unusual spacing in the typing import block slightly disrupts flow, and the ellipsis-only method stub could benefit from a docstring for clarity.
Run 1
Code Structure: Imports followed by a protocol definition form a logical structure, but several imports are unused and the referenced type variables 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 the intended interface, although undefined type variables obscure completeness. Code length: The snippet is concise, but excessive imports add clutter. Action granularity: Each statement has a distinct role; the one-line method stub is conventional for a protocol. Reading flow: Inconsistent spacing in the typing import and missing blank lines before the decorator disrupt otherwise straightforward top-to-bottom reading.
Run 2
Code Structure: Imports precede a focused protocol definition, but inconsistent formatting and missing separation between imports and the class weaken organization. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsItems and its typed items method clearly describe an interface, although undefined type variables _KT_co and _VT_co obscure its setup. Code length: The implementation is concise, but numerous unused imports add clutter. Action granularity: Each statement performs one action; the irregularly packed import list reduces visual clarity. Reading flow: The overall sequence is natural, but uneven spacing, the abrupt decorator placement, and missing type-variable definitions interrupt comprehension.
Run 3
Code Structure: Imports precede a small protocol declaration, but inconsistent formatting and missing spacing between sections weaken organization. Nesting: Minimal nesting makes the snippet easy to follow. Clarity of intent: SupportsItems and its typed items method clearly describe an interface, although _KT_co and _VT_co are not defined in the snippet, and several imports appear unused. Code length: The implementation is concise, but excess imports add clutter. Action granularity: Statements are distinct; the inline ellipsis is conventional for a protocol method. Reading flow: The sequence is logical, but the irregular multiline typing import and lack of blank lines before the class interrupt scanning.