Sample

pyint-b49e52296b5d-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines14

Scores

MethodScoreScale
Posnett0.0230–1; higher is more readable
Dorn0.4620–1; higher is more readable
Mi0.5120–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro17.670–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.6780–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 read(self, length: 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.88−7.319
Source linesThe number of non-empty source lines.14+5.6

Intercept 8.87 + feature contributions = -3.76 (log-odds).
Score = sigmoid(-3.76) = 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.106−0.086

Intercept 0.07 + feature contributions = -0.152 (log-odds).
Score = sigmoid(-0.152) = 0.462.

Score0.512
Score6
Run 1

The code is highly readable. It has a clear, logical structure with imports organized by standard library modules and typing utilities. Nesting is essentially flat — the only indented block is a minimal Protocol method definition. Intent is explicit: it defines a runtime-checkable structural protocol for objects with a `read` method. The code is concise, avoiding any unnecessary verbosity. Action granularity is appropriate, with each import grouping and the Protocol definition on separate logical lines. Reading flow is natural, from future imports down to the protocol definition. The only minor deduction is that the lengthy import block could be slightly streamlined, but it is well-organized and conventional.

Run 2

This code is highly readable. It follows a logical structure by separating imports from type-checking and protocol definitions. The module uses `from __future__ import annotations` to enable forward references, which simplifies typing. The imports are organized: standard library imports (`collections.abc`, `typing`) are grouped, and specific names are imported clearly. The nesting is flat, with only one class definition. The intent is clear: it defines a runtime-checkable protocol `SupportsRead` that mirrors the file-like `read` method. The code length is concise—no unnecessary lines. Action granularity is appropriate: each import and class attribute is on its own line. The reading flow is natural, moving from imports to typing constructs to the protocol definition. The only minor drawback is the use of advanced typing features (`TypeAlias`, `runtime_checkable`, `Protocol`), which may require familiarity with Python typing, but this is not a readability issue for the intended audience.

Run 3

The code is well-structured and highly readable. It uses modern Python typing features (Protocol, TypeVar, runtime_checkable) clearly, with a logical import grouping: future import first, standard library collections/typing modules, then TYPE_CHECKING, Any, Protocol, TypeAlias, TypeVar, runtime_checkable. The class definition is concise with a single method. Nesting is minimal, intent is clear (defining a read protocol), and reading flow is natural. Minor deductions: the unused TypeAlias import and the ellipsis default for `length` slightly reduce clarity, but overall this is excellent, idiomatic Python.

Run 1

Code Structure: Imports followed by a protocol declaration provide logical organization, though several imports are unused and _T_co is not defined in the snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: SupportsRead, the read method, and type annotations clearly describe a readable-object interface, but the missing type-variable definition reduces clarity. Code length: The protocol is concise, while unused imports add unnecessary clutter. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for a protocol method. Reading flow: Natural top-to-bottom progression, although an additional blank line before the top-level class would improve formatting.

Run 2

Code Structure: Imports and the protocol definition are logically organized, though several imports are unused in this snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: SupportsRead clearly describes a read-capable interface, but the undefined _T_co type variable makes the generic declaration incomplete and harder to interpret. Code length: The interface is concise, although the import list is disproportionate to the shown functionality. Action granularity: Each declaration occupies its own line; the inline method stub is conventional for protocols. Reading flow: The progression from imports to decorator, class, and method is natural, but missing separation before the class and the unexplained type variable slightly disrupt readability.

Run 3

Code Structure: Imports and the protocol definition are logically organized, though several imports are unused and _T_co is not defined in the snippet. Nesting: Minimal, with only a method inside a class. Clarity of intent: SupportsRead, runtime_checkable, and the typed read signature clearly express a generic reading interface, but the undefined type variable and specialized typing syntax reduce immediate clarity. Code length: The implementation is concise, although the import list is excessive for the shown code. Action granularity: Each statement serves a single purpose; the one-line method stub is appropriate for a protocol. Reading flow: The progression from imports to decorator, class, and method is natural, but another blank line before the top-level class would improve visual separation.