Sample

pyint-e79ac30883ad-I01

Remove comments and docstrings

Matched original source

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.4570–1; higher is more readable
Mi0.7350–1; higher is more readable
LLOC24Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.4990–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]): 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 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.1236.967−40.82
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.48−6.719

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.36+0.508
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.119−0.219
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 = -0.174 (log-odds).
Score = sigmoid(-0.174) = 0.457.

Score0.735
Score24
Run 1

The code demonstrates good readability with clear structure and typing. The ConfigAttribute class is logically organized with well-defined methods for descriptor behavior. Nesting is minimal, with only one conditional in __get__ for the converter check. Intent is clear through descriptive names and type hints. Code length is concise and avoids redundancy. Action granularity is mostly one action per line, though the __set__ method could be more explicit. Reading flow is natural, starting with class definition and proceeding methodically through methods. Minor issues include the trailing 'te.Self' typo, inconsistent spacing around decorators, and slightly compressed logic in __get__ that could benefit from a temporary variable. Overall, the code is clean and maintainable but falls short of exemplary due to its brevity and minor formatting inconsistencies.

Run 2

The code is generally readable with clear structure, type hints, and concise methods. However, there are minor issues: the overloads for __get__ reference 'te.Self' and 'App' without visible imports in the snippet, which may confuse readers. The __get__ method has slightly more than one logical action per line in the conversion block, and the return 'rv' line has trailing spaces. Overall, intent is clear and nesting is minimal, but the missing context for referenced types slightly reduces clarity.

Run 3

The code is highly readable due to its clear structure, minimal nesting, and consistent typing. The class has a single responsibility and uses descriptive names. Type hints and overloads enhance clarity and intent. Each method performs a focused action with clear logic flow. The only minor deductions are for slight line-length in signatures and the presence of two nearly identical overload decorators, which could be simplified. Overall, the code is well-organized, concise, and easy to follow.

Run 1

Code Structure: The class logically groups initialization, descriptor access, and assignment, although several imports are unused and T, te, and App are not defined in the snippet. Nesting: Shallow conditionals and an early return keep control flow simple. Clarity of intent: Standard descriptor methods and type annotations convey configuration-backed attribute access, but rv is vague and there is no explanatory docstring. Code length: The implementation is concise; overloads add useful typing information rather than unnecessary complexity. Action granularity: Each statement performs one clear action. Reading flow: Methods follow a natural initialization/get/set order, though excess blank lines, trailing whitespace, and unresolved typing names slightly interrupt readability.

Run 2

Code Structure: Methods are logically organized within a focused descriptor class, although several imports are unused and T, te, and App lack visible definitions or imports. Nesting: Shallow conditionals and an early return make execution easy to follow. Clarity of intent: Configuration access and optional value conversion are reasonably clear, aided by type annotations, but the absence of a class docstring and the abbreviated variable rv slightly reduce clarity. Code length: The implementation is concise, with only minor excess whitespace. Action granularity: Each statement performs one clear action. Reading flow: Initialization, getter overloads, getter implementation, and setter follow a natural order; overload syntax adds some complexity, while inconsistent spacing and unresolved typing names interrupt otherwise smooth reading.

Run 3

Code Structure: The descriptor class logically groups initialization, overloaded access, retrieval, and assignment, though unused imports and undefined references (T, te, App) distract. Nesting: Shallow conditionals and an early return keep control flow simple. Clarity of intent: Method names, type annotations, and straightforward configuration access convey the purpose, but rv is vague and descriptor behavior lacks explanation. Code length: The implementation is concise; extra blank lines and unused imports add minor clutter. Action granularity: Each statement performs one clear action. Reading flow: Methods follow a natural lifecycle, with overloads directly preceding their implementation; missing type context and inconsistent whitespace slightly interrupt readability.