Sample

pyint-9014622913e7-I05

Rewrite eligible decimal integer literals in hexadecimal notation

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 is well-structured and highly readable. It uses clear class and method definitions with descriptive names, type hints, and overloads that clarify intent. The nesting is minimal, with only a couple of conditional blocks, and each action is separated into distinct lines, improving granularity. The reading flow is natural—initialization, getter, setter—following a logical progression. The use of `@t.overload` improves IDE support and intent clarity, though it slightly increases length. Overall, the code is concise for its purpose and avoids unnecessary complexity.

Run 3

The code is highly readable with a clear, focused purpose: implementing a descriptor that forwards attribute access to a config object. Structure is logical, with type hints and overloads enhancing clarity. Nesting is minimal, limited to two simple conditionals within __get__. Variable names are concise yet descriptive. Action granularity is appropriate, with one logical operation per line. The reading flow is natural, following standard Python descriptor patterns. Minor deductions: the missing import for 'te' and reliance on type-ignore comments slightly reduce clarity, and the overload signatures could be simplified for readability, but overall the code is well-organized and maintainable.

Run 1

Code Structure: The descriptor 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 forwarding attribute access to configuration, with optional conversion. However, T, te, and App are undefined in the snippet, several imports are unused, and rv is a vague variable name. Code length: The implementation is concise; overloads add length but clarify typing behavior. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Methods and whitespace support natural top-to-bottom reading, although unexplained typing dependencies and unused imports introduce minor distractions.

Run 2

Code Structure: The descriptor is logically organized into initialization, getter overloads, retrieval, and assignment. Nesting: Shallow conditionals and an early return keep control flow simple. Clarity of intent: The docstring, method names, and type annotations clearly communicate configuration forwarding and optional conversion, although T, te, and App lack definitions or imports in the snippet, and rv is a vague variable name. Code length: The implementation is concise; overloads add length but convey useful typing information. Action granularity: Each statement performs a single clear action. Reading flow: Consistent formatting and whitespace make the code easy to follow, though unused imports introduce clutter and unresolved typing references require outside context.

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 control flow simple. Clarity of intent: The docstring, method names, and type annotations clearly convey forwarding attributes to configuration with optional conversion, although 'rv' is vague and T, te, and App are not defined in the snippet. Code length: Concise overall, but several unused imports add clutter. Action granularity: Each statement performs a single action, making operations easy to follow. Reading flow: Conventional method ordering and whitespace support natural reading; dense type annotations and overload declarations introduce minor friction.