Sample

pyint-5f705337b238-I09

Select one of ten low-readability unrelated code templates per class

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

The code is well-structured and readable. Imports are organized logically across three statements with clear grouping. The use of `from __future__ import annotations` is standard practice. The Protocol class definition is concise with a clear single-method interface. Nesting is minimal—no nested blocks. The type parameters and runtime_checkable decorator show clear intent. Action granularity is appropriate, with each statement on its own line. The reading flow is natural: imports, then type declarations, then class definition. Minor deductions: the unused `Iterable`, `Mapping`, `MutableMapping`, `Sequence`, `TypeAlias`, `TypeVar`, and `TYPE_CHECKING` imports reduce clarity slightly, and positioning the `...` default value with `/` positional-only syntax might require some Python expertise to fully appreciate.

Run 3

The code is highly readable. It has a clear, logical structure: future import, grouped standard library imports, and a well-organized typing import. The Protocol class is concise, with a single method that clearly defines a read interface using modern Python typing syntax. Nesting is minimal and flat. The intent—defining a runtime-checkable protocol for objects with a read method—is explicit. Code length is appropriate, with no redundancy. Each import and method definition is on its own line, maintaining good action granularity. Reading flow is natural and idiomatic. Minor deductions only for the slightly dense typing imports, but these are standard for such type-focused code.

Run 1

Code Structure: Imports precede a clearly defined protocol, providing logical organization, although several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsRead and its typed read method clearly describe a readable-object interface, but the undefined _T_co leaves the generic type unclear. Code length: The protocol is concise, though the import list is disproportionately long for the functionality shown. Action granularity: Statements are cleanly separated; the inline ellipsis is conventional for protocol method declarations. Reading flow: The sequence from imports to decorator, class, and method is natural, although an additional blank line before the class would improve visual separation.

Run 2

Code Structure: Imports and the protocol declaration are logically organized, though many imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsRead clearly describes a read-capable interface, but _T_co is not defined in the supplied code, obscuring the generic return type. Protocol syntax, ellipsis defaults, and positional-only parameters require familiarity with Python typing. Code length: The declaration is concise, but the import list is unnecessarily broad for this snippet. Action granularity: Each line generally serves one purpose; the one-line method stub is appropriate for a protocol. Reading flow: The progression from imports to interface is natural, though a blank line before the decorator would improve conventional formatting.

Run 3

Code Structure: Imports and the protocol declaration are logically organized, although several imports are unused in this snippet. Nesting: Minimal nesting keeps the code easy to scan. Clarity of intent: SupportsRead and read clearly describe a readable-object interface, but _T_co is not defined in the provided code, and the generic typing syntax requires familiarity with protocols. Code length: The declaration is concise, though the unused imports add clutter. Action granularity: Statements are separated cleanly; the one-line method stub is appropriate for a protocol. Reading flow: The progression from imports to interface is natural, but an additional blank line before the top-level class and a visible type-variable definition would improve readability.