Sample

pyint-9efa3a1a85e0-I08

Select one of ten high-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 Pro180–20; mean of three runs
GPT-6.1 Sol15.330–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 highly readable. It is a short, focused module defining a runtime-checkable protocol. The structure is clean and dependencies are imported concisely. Nesting is minimal. Intent is unambiguous: to declare a protocol for objects with a `read` method returning a covariant type. The use of `TypeVar` and `Protocol` with a positional-only parameter demonstrates clear understanding of typing. Code length is appropriate and not inflated. Each import is broken into logical lines, improving scannability and reducing horizontal scroll. Reading flow is natural, ending with the core protocol definition. The only minor deductions are that some imported names are not used in this isolated snippet, slightly reducing focus, and the ellipsis default is somewhat implicit for a novice.

Run 3

The code is highly readable. Structure is clean with logical import grouping and type-checking conditional imports. Nesting is minimal (just a nested import statement). Intent is clear — defining a runtime-checkable protocol for objects with a `read` method. It is concise, with one import per group and one class member. Action granularity is appropriate: each import and method definition is on its own line. Reading flow is natural, from future import to standard library imports to type-specific imports. Minor deductions only for the slightly abstract `_T_co` name and reliance on familiarity with `Protocol` and `TypeVar` semantics.

Run 1

Code Structure: Imports and the protocol declaration are logically organized, although many imports are unused in this snippet. Nesting: Minimal nesting makes it easy to scan. Clarity of intent: SupportsRead and its read signature clearly describe a structural interface, but _T_co is undefined in the shown code, obscuring the generic return type. Code length: The protocol is concise, though the import list is disproportionate to its visible needs. Action granularity: Each statement has a distinct 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 understanding the type parameter requires missing context.

Run 2

Code Structure: Imports and the protocol declaration are logically organized, though _T_co is undefined in the snippet and several imports are unused. Nesting: Minimal, with only a class and its method. Clarity of intent: SupportsRead and read clearly describe a readable-object interface, but the undeclared type variable and advanced typing syntax reduce immediate comprehension. Code length: The interface is concise, although the extensive imports are unnecessary for the shown code. Action granularity: Each import or declaration occupies a distinct statement; the inline method stub is conventional for protocols. Reading flow: The progression from imports to decorator to interface is natural, but additional spacing before the class and a definition of _T_co would improve readability.

Run 3

Code Structure: Imports and the protocol declaration are logically organized, though several imports appear unused. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsRead clearly describes a read-capable interface, but _T_co is not defined in the provided code, obscuring the generic return type. Code length: The declaration is concise, although the import list is excessive for this snippet. Action granularity: Each statement has a distinct 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 unfamiliar syntax such as the positional-only marker and ellipsis default requires typing knowledge. An additional blank line before the top-level class would improve visual separation.