Sample

pyint-341100691abe-I01

Remove comments and docstrings

Matched original source

Lines39

Scores

MethodScoreScale
Posnett0.0170–1; higher is more readable
Dorn0.7990–1; higher is more readable
Mi0.7190–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.7310–1; higher is more readable

Views

Source code

from __future__ import annotations import abc import contextlib import enum import itertools import linecache import sys import types import unicodedata import weakref from collections.abc import Callable, Mapping from functools import cached_property from typing import Any, NamedTuple, TypeVar from . import _compat, _config, setters from ._compat import ( PY_3_11_PLUS, PY_3_13_PLUS, _AnnotationExtractor, _get_annotations, _lazy_is_generator, get_generic_base, ) from .exceptions import ( DefaultAlreadySetError, FrozenInstanceError, NotAnAttrsClassError, UnannotatedAttributeError, ) class _Nothing(enum.Enum): NOTHING = enum.auto() def __repr__(self): return "NOTHING" def __bool__(self): return False

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.650.302−21.46
Source linesThe number of non-empty source lines.39+15.6
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.707−7.061

Intercept 8.87 + feature contributions = -4.051 (log-odds).
Score = sigmoid(-4.051) = 0.017.

Feature contributions

FeatureValueContribution
(log-odds)
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.44.925+1.762
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.39+0.612
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.39−0.474
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.05+0.457
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.40−0.38
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.38.891+0.134

Intercept 0.07 + feature contributions = 1.377 (log-odds).
Score = sigmoid(1.377) = 0.799.

Score0.719
Score22
Run 1

The code demonstrates excellent readability: logical grouping of imports (standard library, third-party, local), flat structure with minimal nesting, and clear intent through well-chosen names like _Nothing, NOTHING, and exception classes. The enum class is concise and self-documenting. However, the score of 18/20 reflects minor redundancy: the explicit 'return False' in __bool__ is unnecessary since NOTHING already has bool value False, and the blank line after the class colon is slightly unconventional. Action granularity is perfect — one behavior per method. Reading flow is natural and imports follow PEP 8 conventions. Overall, this is production-quality readable code with only trivial stylistic imperfections.

Run 2

The code demonstrates strong readability with a clear, logical structure. The imports are organized into standard library, third-party, and local modules, with explicit grouping. The `_Nothing` class uses an Enum with a single member, making its purpose clear and preventing misuse. The methods `__repr__` and `__bool__` are concise and intuitive. Nesting is flat, with no complex conditionals or loops. Action granularity is good, with one operation per line. Type hints and future annotations are used appropriately. The code is concise but not overly terse, and the naming conventions (e.g., leading underscore for private internals) aid understanding. Minor deductions: the blank line after the class definition is slightly unusual, and some import aliases (e.g., `_lazy_is_generator`) could benefit from a brief comment if their purpose isn't obvious from context. Overall, the code is highly readable and maintainable.

Run 3

The code has a clear modular structure with logical imports and a well-defined enum class, contributing to readability. However, several issues lower the score: excessive blank lines within the class body disrupt reading flow, the class name '_Nothing' and its single member 'NOTHING' are conceptually clear but the extra space before methods is inconsistent. The import section is long but organized by type (stdlib, local), yet some imports could be grouped more tightly. Action granularity is mostly one per line, but the enum definition could be more concise. The overall intent is discernible—defining a singleton sentinel—but the presentation feels fragmented. Nesting is shallow, which is good. Code length is appropriate for the functionality. The main weaknesses are formatting inconsistencies and slightly awkward class body spacing, making the code feel less polished than it could be.

Run 1

Code Structure: Imports are grouped conventionally, followed by a small, cohesive enum class, although many imports are unused in this excerpt. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The NOTHING enum member and its representation and boolean behavior clearly suggest a sentinel, though its intended use is not documented. Code length: The class is concise, but the extensive import list and excess blank space add visual overhead. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: The progression from imports to the enum member and its methods is natural; the blank lines immediately inside the class slightly interrupt it.

Run 2

Code Structure: Imports are grouped before a small, logically organized enum class, though many imports are unused in this excerpt. Nesting: Minimal, with only class methods and no nested control flow. Clarity of intent: NOTHING clearly represents a sentinel, and its representation and falsy behavior are explicit, although a brief class docstring would clarify its purpose. Code length: The implementation is concise, but the extensive import block outweighs the visible functionality. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: Methods are straightforward and naturally ordered; excessive blank space inside the class and limited separation between import groups slightly reduce polish.

Run 3

Code Structure: Imports precede a small, logically organized enum class, though many imports are unrelated to the visible implementation. Nesting: Minimal, with only class and method scopes. Clarity of intent: The NOTHING sentinel is recognizable, and its representation and falsy behavior are explicit, although its intended use is undocumented. Code length: The class is concise, but the extensive import section and extra blank lines add clutter to this excerpt. Action granularity: Each statement performs a single action, with no compressed or compound operations. Reading flow: Conventional Python organization and straightforward methods make the code easy to follow; unused-looking imports and irregular whitespace slightly interrupt the flow.