Sample

pyint-1ffeae524646-I07

Insert deterministic runtime-dead branches into callable bodies

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 Pro180–20; mean of three runs
GPT-6.1 Sol170–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 highly readable due to its clear logical structure, minimal nesting, and explicit intent. It uses modern Python typing features and a Protocol to define a structural type, which is concise and purposeful. The imports are well-organized, and the runtime_checkable decorator clearly signals runtime type-checking intent. The only minor deductions are for slightly verbose import formatting and the protocol method lacking an implementation body, which is idiomatic but could momentarily confuse less experienced readers.

Run 3

The code is highly readable. It has a clear, logical structure: a future import, grouped standard library imports, and a well-organized typing import block. Nesting is minimal, limited to a single protocol class definition. The intent is unambiguous—defining a runtime-checkable protocol for objects with an `items` method. The code is concise and uses modern Python typing features appropriately. Each import is on its own line, and the protocol method signature is clear. The only minor drawback is the slightly verbose multi-line typing import, which could be simplified, but this is a common and acceptable practice. Overall, the code is nearly exemplary in readability.

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 its typed items method clearly describe an interface for iterable key-value pairs, but _KT_co and _VT_co are undefined here, obscuring the generic parameters. Code length: Very concise, with some unnecessary import overhead. 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, although an additional blank line before the top-level class would improve formatting.

Run 2

Code Structure: Imports and the protocol declaration are logically organized. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsItems clearly describes an interface exposing items(), and the return annotation communicates key-value pairs; however, _KT_co and _VT_co are undefined in the provided snippet, and several imports are unused. Code length: The implementation is concise, though excess imports add clutter. Action granularity: Each statement has a distinct purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The progression from imports to decorator, class, and method is natural, but missing type-variable definitions interrupt understanding.

Run 3

Code Structure: Imports and the protocol definition are logically organized. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: SupportsItems, the items method, and its return annotation clearly describe a structural interface, but _KT_co and _VT_co are undefined in the provided snippet, obscuring the generic parameters. Code length: The definition is concise, although several imports are unused here and add clutter. Action granularity: Each statement serves a single purpose; the inline ellipsis is conventional for protocol methods. Reading flow: The progression from imports to decorator to class and method is natural, though additional spacing before the top-level class would improve visual separation.