Sample

pyint-2115b34e2716-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines32

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6520–1; higher is more readable
Mi0.4010–1; higher is more readable
LLOC25Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.4710–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.32+12.8
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.546−6.819

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.109+0.954
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.109−0.952
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.31+0.335
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.109−0.116
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.31.709+0.033

Intercept 0.07 + feature contributions = 0.626 (log-odds).
Score = sigmoid(0.626) = 0.652.

Score0.401
Score25
Run 1

The code is generally clear and well-structured, following common patterns for a descriptor class. It uses type hints effectively, and methods have clear, single responsibilities. The constructor's unusual spacing slightly hurts readability, and the fragmented class structure (with scattered methods) adds minor visual clutter. The overloaded __get__ signatures are clear for type-aware readers. Overall, the code is concise with good logical organization and natural reading flow, but small formatting and structural choices prevent a perfect score.

Run 2

The code is generally clean and well-structured, with clear intent and type hints. However, a few issues reduce readability: the constructor's parameter list is split across multiple lines awkwardly, the `te.Self` reference appears undefined (likely a typo for `typing.Self`), and `__get__` and `__set__` are on adjacent lines without a blank line between them. The overloads add clarity but also increase visual clutter. Overall, it is concise and logically organized but has minor formatting inconsistencies.

Run 3

The code is generally readable and follows common patterns for descriptors, but has several issues that reduce clarity. The conditional return in __get__ creates multiple exit paths and the converter check is nested. There's an undefined 'te' namespace used for 'Self' type hints, and inconsistent formatting with unusual line breaks in __init__. The lack of docstrings on methods (aside from the class) and no type checking on the config access makes the intent slightly ambiguous. The reading flow is disrupted by awkward line breaks and missing whitespace between methods. The overall structure is logical but the implementation could be more concise and consistent.

Run 1

Code Structure: The descriptor class is logically organized into initialization, retrieval, and assignment, but spacing between methods is inconsistent and several imports appear unused. Nesting: Control flow is shallow, with straightforward conditionals and early return. Clarity of intent: The docstring, method names, and type annotations clearly communicate configuration forwarding and optional conversion, although T, te, and App are not defined in the snippet, and rv is a vague name. Code length: The implementation is concise without unnecessary logic, though imports add clutter. Action granularity: Each executable line performs a single action. Reading flow: Operations follow a natural sequence, but excessive spacing in the constructor signature and tightly packed overload declarations interrupt readability.

Run 2

Code Structure: The descriptor class logically groups initialization, retrieval, and assignment, though missing definitions for T, te, and App and unused imports make the snippet less self-contained. Nesting: Shallow conditionals keep the implementation easy to follow. Clarity of intent: The docstring and config access clearly convey attribute forwarding; annotations communicate expected types, although rv is a vague name. Code length: The implementation is concise, with some unnecessary imports. Action granularity: Statements generally perform one action per line; compact overload declarations remain understandable. Reading flow: Retrieval follows a natural sequence of checking the instance, accessing configuration, optionally converting, and returning. However, irregular spacing in __init__ and missing blank lines between some methods reduce visual consistency.

Run 3

Code Structure: The descriptor class is logically organized into initialization, retrieval, and assignment, but missing spacing between methods weakens separation. Nesting: Shallow conditionals and an early return keep complexity low. Clarity of intent: The docstring and config access make the forwarding behavior clear, although the undefined names T, te, and App obscure typing context, and rv is a vague variable name. Code length: The implementation is concise, but several unused imports introduce clutter. Action granularity: Statements generally perform one action per line; compact overload declarations remain understandable. Reading flow: Operations follow a natural sequence, but irregular whitespace in the constructor, tightly packed overloads, and inconsistent blank lines interrupt scanning.