Sample
pyint-ab0cfd72f969-I06
Invert eligible conditions and exchange their branches
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 | 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 highly readable due to its clear, logical structure. It uses modern Python typing features (Protocol, TypeVar, runtime_checkable) with consistent import grouping and explicit type aliases. The single class definition is flat, concise, and unambiguous—each element serves a specific purpose with no redundant or tangled logic. Action granularity is one import per line in most cases, and the protocol method signature is cleanly defined. Minor deductions for slightly verbose imports, but overall intent and flow are excellent.
Run 3
The code is highly readable. Imports are well-organized and logically grouped, with clear separation between __future__, collections.abc, and typing modules. The Protocol definition is concise and demonstrates clear intent through the use of TypeVars and runtime_checkable. Naming follows standard Python conventions, and there is no unnecessary nesting or verbosity. The single method definition uses an ellipsis to correctly indicate an abstract interface. One minor point: depending on the codebase, the scoring could be 19-20, but the absence of a docstring slightly reduces clarity of intent.
Run 1
Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal, with only a single method inside the class. Clarity of intent: SupportsItems and the typed items() signature clearly describe the interface, but _KT_co and _VT_co are not defined in the snippet, leaving their meaning incomplete. Code length: The implementation is concise, although several unused imports add clutter. Action granularity: Each import or declaration occupies a distinct statement; the inline ellipsis is appropriate for a protocol method. Reading flow: The progression from imports to interface is natural, though additional spacing before the decorated class would improve visual separation.
Run 2
Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal nesting keeps the snippet easy to scan. Clarity of intent: SupportsItems, its items method, and the return annotation clearly express an interface for iterable key-value pairs, though _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 serves a distinct purpose; the inline ellipsis is conventional for a protocol method. Reading flow: The progression from imports to decorator, class, and method is natural, although an additional blank line before the top-level class would improve visual separation.
Run 3
Code Structure: Imports and a single protocol declaration are logically organized, although the referenced type variables are not defined in the snippet. Nesting: Minimal, with only one method inside the class. Clarity of intent: SupportsItems, items(), and the return annotation clearly describe an interface for iterable key-value pairs; unexplained type variables and unused imports add ambiguity. Code length: The implementation is concise, but the import list is disproportionately large for the code shown. Action granularity: Each statement serves one purpose, and the inline ellipsis is conventional for a protocol method. Reading flow: The progression from imports to decorator, class, and method is natural; additional spacing before the top-level class and definitions for the type variables would improve readability.