Sample

pyint-4b6ceb45fba7-I11

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

Matched original source

Lines14

Scores

MethodScoreScale
Posnett0.0190–1; higher is more readable
Dorn0.4870–1; higher is more readable
Mi0.4830–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.6930–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 SupportsItems(Protocol[_KT_co, _VT_co]): def items(self) -> Iterable[tuple[_KT_co, _VT_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.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

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.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.

Score0.483
Score6
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 well-structured and highly readable for its purpose. It uses clear imports, modern type hinting (Protocol, TypeAlias, TypeVar), and a concise runtime-checkable protocol definition. The use of `TYPE_CHECKING` and `from __future__ import annotations` shows awareness of runtime vs static typing concerns. Nesting is minimal, and the protocol’s intent is explicit. However, the score is slightly reduced because the code assumes familiarity with advanced typing constructs (Protocol, TypeVar, runtime_checkable), which may reduce clarity for less experienced readers. Also, the `items()` method’s return type `Iterable[tuple[_KT_co, _VT_co]]` is slightly verbose for such a simple protocol. Overall, it follows SOLID and modern Python practices well.

Run 3

The code is well-structured and readable. It organizes imports logically, including future annotations, collection ABCs, and typing constructs. Nesting is minimal and flat. Intent is clear: defining a runtime-checkable protocol that enforces an `items()` method returning an iterable of key-value tuples. However, the trailing `...` in the protocol method and the separate imports could be slightly more concise. Overall, it maintains one action per line and flows naturally for a type definition.

Run 1

Code Structure: Imports and the protocol definition are logically organized, though several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems and the items signature clearly describe an interface for objects exposing key-value pairs, but undefined type variables _KT_co and _VT_co obscure their meaning and make the snippet incomplete. Code length: Concise overall, although the unused imports add clutter. Action granularity: Each import or declaration occupies a distinct statement; the one-line method stub is appropriate for a protocol. Reading flow: The progression from imports to decorator to interface is natural, but an additional blank line before the top-level class would improve visual separation.

Run 2

Code Structure: Imports and the protocol definition are logically organized, although the displayed snippet imports several unused names and does not define _KT_co or _VT_co. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: SupportsItems and the typed items method clearly describe an interface for objects exposing key-value pairs, but unexplained type variables reduce self-contained clarity. Code length: The implementation is concise, though the import list is disproportionately large for this snippet. Action granularity: Each import, decorator, and declaration serves a distinct purpose; the one-line method stub is appropriate for a protocol. Reading flow: The progression from imports to decorator to interface is natural, with the missing type-variable definitions interrupting understanding.

Run 3

Code Structure: Imports and the protocol declaration are logically organized, though several imports are unused in this snippet. Nesting: Minimal nesting makes it easy to scan. Clarity of intent: SupportsItems clearly describes an interface for objects exposing items(), and the return annotation is informative; however, _KT_co and _VT_co are not defined in the provided code, obscuring the generic parameters. Code length: The snippet is concise, although the unused imports add clutter. Action granularity: Each line 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, but missing type-variable definitions interrupt comprehension.