Sample

pyint-8c2a7cb7e05c-I12

Inline all eligible single-use intermediate local 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 Pro16.670–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 generally readable with clear structure and intent. It uses modern Python typing syntax, concise docstrings, and overloaded getters to improve clarity. Nesting is minimal, and actions are mostly one per line. However, readability is slightly reduced by the use of a forward reference `te.Self` without immediately visible import, and `type: ignore` comments that hint at typing workarounds. The `__get__` method combines attribute access, config lookup, optional conversion, and return in a compact but still understandable flow. The descriptor pattern is standard but may require domain knowledge to grasp fully. Overall, it's well-organized but could benefit from a brief class-level comment explaining the descriptor's role or the `te` import context.

Run 3

The code is highly readable with clear structure and logical organization. It uses type hints consistently, follows a flat structure with minimal nesting, and each method has a single responsibility. The use of overloads for __get__ clearly communicates intent, though the type annotations are slightly verbose. The ConfigAttribute class is concise and focused, with proper separation of concerns. The reading flow is natural, progressing from initialization to getter to setter. Minor deductions for the complex generic typing which adds some cognitive load, and the type: ignore comment suggests a slight workaround. Overall, the code demonstrates excellent readability with clear naming, proper documentation, and maintainable design patterns.

Run 1

Code Structure: The descriptor class is logically organized into initialization, retrieval, and assignment methods, with overloads grouped appropriately. Nesting: Minimal nesting and an early return keep control flow flat. Clarity of intent: The docstring, method names, and type annotations clearly communicate configuration forwarding, though the abbreviated variable 'rv' and undefined names T, te, and App reduce standalone clarity. Code length: The implementation is concise, but several unused imports add clutter. Action granularity: Each statement performs one clear action. Reading flow: The progression from setup to access and mutation is natural, with helpful whitespace; the overload declarations and type-ignore comment introduce modest visual complexity.

Run 2

Code Structure: The descriptor class is logically organized into initialization, overloaded access signatures, retrieval, and assignment. Nesting: Shallow conditionals and an early return keep control flow simple. Clarity of intent: The docstring, method names, and type annotations communicate configuration forwarding, although the abbreviated variable 'rv' and undefined references T, te, and App reduce standalone clarity. Code length: Concise overall; overloads add length but clarify typing behavior. Action granularity: Each statement performs a single action, with no compressed multi-operation lines. Reading flow: Retrieval follows a natural sequence of handling class access, fetching the configuration value, optionally converting it, and returning it. Additional spacing between imports and the class would improve visual organization.

Run 3

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 communicate configuration forwarding and optional conversion, although T, te, and App are not defined in the snippet, 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 follow a natural descriptor lifecycle, and whitespace separates logical steps. Unused imports and missing separation between imports and the class slightly reduce polish.