Sample
pyint-ba0ec94337e6-I01
Remove comments and docstrings
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.67 | 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 highly readable. It has a clear, logical structure, starting with future imports, then standard library imports, followed by typing imports, and finally a protocol definition. Nesting is minimal and flat. The intent is unambiguous: defining a runtime-checkable Protocol for objects with an 'items' method, useful for structural typing. Code length is concise and appropriate for the task. Each import and the class/method definition occupy their own lines, demonstrating good action granularity. The reading flow is natural, from general imports to the specific type definition.
Run 2
The code is well-structured and readable. It clearly imports necessary components from the typing and collections modules, and defines a Protocol class with a straightforward method signature. The use of type variables and runtime_checkable decorator is idiomatic and appropriate for a protocol definition. The code is concise, with logical grouping and flat structure. However, minor deductions for somewhat dense type-heavy syntax and the fact that the Protocol class body lacks a docstring explaining its intended use or contract, which slightly reduces clarity of intent.
Run 3
The code is highly readable, with clean structure, flat nesting, clear intent, concise length, one action per line, and natural reading flow. It uses modern Python typing conventions with a protocol definition, type aliases, and decorators. Each import and type hint is logically organized, making the purpose immediately clear to experienced Python developers.
Run 1
Code Structure: Imports and the protocol definition are logically organized, though _KT_co and _VT_co are not defined in the snippet and several imports appear unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems, the items method, and its return annotation clearly describe an interface for iterable key-value pairs, although understanding Protocol requires typing knowledge. Code length: The definition is concise, but unused imports add clutter. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for a protocol stub. Reading flow: The progression from imports to decorator to interface is natural, though additional spacing before the class and definitions for the type variables would improve readability.
Run 2
Code Structure: Imports followed by a protocol declaration are logically organized, though _KT_co and _VT_co are not defined in the snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: SupportsItems and the typed items method clearly describe an interface, but unexplained type variables and numerous unused imports add ambiguity. Code length: The implementation is concise, while the import list is unnecessarily broad for the shown code. Action granularity: Each statement has a distinct purpose; the inline ellipsis is appropriate for a protocol method. Reading flow: Natural top-to-bottom progression, slightly weakened by missing spacing before the decorated class and the unresolved type variables.
Run 3
Code Structure: Imports and a single protocol are logically organized, though several imports are unused in this snippet. Nesting: Minimal, with only one method inside the class. Clarity of intent: SupportsItems and its typed items method clearly describe an interface, but _KT_co and _VT_co are not defined in the provided code, obscuring the generic setup. Code length: Concise overall, although the import list is excessive for the visible implementation. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for a protocol method. Reading flow: Natural progression from imports to decorator, class, and method, but missing type-variable definitions interrupt understanding.