Sample

pyint-cec6277a65cb-I11

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

Matched original source

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7820–1; higher is more readable
Mi0.7250–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.5050–1; higher is more readable

Views

Source code

from __future__ import annotations import errno import json import os import types import typing as t from werkzeug.utils import import_string class ConfigAttribute(t.Generic[T]): """Makes an attribute forward to the config""" def __init__( self, name: str, get_converter: t.Callable[[t.Any], T] | None = None ) -> None: self.__name__ = name self.get_converter = get_converter @t.overload def __get__(self, obj: None, owner: None) -> te.Self: ... @t.overload def __get__(self, obj: App, owner: type[App]) -> T: ... def __get__(self, obj: App | None, owner: type[App] | None = None) -> T | te.Self: if obj is None: return self rv = obj.config[self.__name__] if self.get_converter is not None: rv = self.get_converter(rv) return rv # type: ignore[no-any-return] def __set__(self, obj: App, value: t.Any) -> None: obj.config[self.__name__] = value

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.1248.238−41.192
Source linesThe number of non-empty source lines.36+14.4
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.552−6.828

Intercept 8.87 + feature contributions = -24.75 (log-odds).
Score = sigmoid(-24.75) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.85.946+0.582
Indentation frequencyHow rapidly indentation changes from line to line.35+0.473
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.36−0.238
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.109−0.118
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.35.598+0.088
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.85.973+0.024

Intercept 0.07 + feature contributions = 1.279 (log-odds).
Score = sigmoid(1.279) = 0.782.

Score0.725
Score25
Run 1

The code is well-structured with concise, focused methods. The use of overloads for type hinting improves clarity for type checkers, but the unused imports (errno, json, os, import_string) slightly detract from cleanliness. The class has a clear purpose and docstring. Nesting is minimal, and the reading flow is natural. Although one line combines setting and returning, it's still clear. Overall, it's highly readable.

Run 2

The code demonstrates strong readability through clear structure, minimal nesting, and explicit type hints. Each method has a single responsibility, and the action granularity is appropriate — one logical operation per line. The use of overloaded signatures clearly documents the intended behavior for descriptor access, and the flow is natural: type declarations, initialization, then descriptor protocol implementation. Minor deductions: the `# type: ignore` comment slightly interrupts flow, and the `owner` parameter in `__get__` is unused, which could confuse readers. Overall, this is concise, well-organized, and unambiguous code.

Run 3

The code is highly readable due to its clear structure, flat nesting, and explicit typing. Each method has a single responsibility, and the use of type hints and overloads clarifies intent. The class and method names are self-documenting, and the logic flows naturally. Minor issues include a missing import for `te` and a slightly verbose typing approach, which slightly reduce clarity but do not significantly hinder readability.

Run 1

Code Structure: The descriptor class is logically organized into initialization, getter overloads, getter implementation, and setter. Nesting: Minimal nesting and an early return keep control flow flat. Clarity of intent: The docstring, method names, and type annotations clearly convey configuration forwarding and optional conversion, although T, te, and App are not defined or imported in the snippet, and rv is a vague variable name. Code length: The implementation is concise; overloads add useful typing detail, but several unused imports introduce clutter. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order and whitespace separates logical steps, though missing separation between imports and the class slightly reduces polish.

Run 2

Code Structure: Imports and a focused descriptor class are logically organized, with distinct initialization, retrieval, and assignment methods. Nesting: Shallow conditionals and an early return keep control flow simple. Clarity of intent: The docstring, method names, and type annotations explain configuration forwarding and optional conversion, though T, te, and App are not defined or imported in the snippet, and rv is a vague name. Code length: Concise overall; overloads add length but convey useful typing distinctions. Action granularity: Each statement performs a single action, with no compressed multi-operation lines. Reading flow: Methods follow a natural sequence, and whitespace separates logical steps. Missing typing context and dense annotations slightly interrupt otherwise straightforward reading.

Run 3

Code Structure: The descriptor class is logically organized into initialization, getter overloads, retrieval, and assignment. Nesting: Shallow conditionals and an early return keep the implementation flat. Clarity of intent: The docstring, method names, and annotations clearly communicate config forwarding and optional conversion, although 'rv' is vague and T, te, and App are not defined or imported in the snippet. Code length: The implementation is concise, but several unused imports add clutter; overloads add length while providing useful typing information. Action granularity: Each statement performs one clear action. Reading flow: Consistent formatting and whitespace make the getter easy to follow, though unresolved typing references and the type-ignore comment introduce minor distractions.