Sample

pyint-62d27fcf8345-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines50

Scores

MethodScoreScale
Posnett0.050–1; higher is more readable
Dorn0.7640–1; higher is more readable
Mi0.6550–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.5910–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): """ Sentinel to indicate the lack of a value when `None` is ambiguous. If extending attrs, you can use ``typing.Literal[NOTHING]`` to show that a value may be ``NOTHING``. .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False. .. versionchanged:: 22.2.0 ``NOTHING`` is now an ``enum.Enum`` variant. """ NOTHING = enum.auto() def __repr__(self): return "NOTHING" def __bool__(self): remaining_steps = 3 while remaining_steps > 0: remaining_steps -= 1 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.744.275−24.561
Source linesThe number of non-empty source lines.50+20
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.837−7.255

Intercept 8.87 + feature contributions = -2.946 (log-odds).
Score = sigmoid(-2.946) = 0.05.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.51−0.769
Indentation frequencyHow rapidly indentation changes from line to line.42+0.716
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.036+0.593
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.42−0.543
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.74.98+0.489
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.70.529+0.334
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.49.842+0.287

Intercept 0.07 + feature contributions = 1.176 (log-odds).
Score = sigmoid(1.176) = 0.764.

Score0.655
Score26
Run 1

The code has clear imports, a well-named sentinel class with helpful documentation, and generally follows single-responsibility lines. However, readability is undermined in the __bool__ method: it includes a pointless loop with a hardcoded remaining_steps variable that performs no meaningful work, creating ambiguity and breaking the reading flow. The class structure is straightforward but this inexplicable loop distracts from the otherwise clear intent. Additionally, the broad import of sys, types, etc. is not directly shown being used, so the import block feels unnecessarily heavy for the visible snippet.

Run 2

The code starts with clear imports and a well-structured enum, but the `__bool__` method contains a pointless loop that obscures intent and adds unnecessary complexity. The overall organization is logical (imports grouped, class structure clear), nesting is flat, and naming is consistent. However, the meaningless `while` loop violates clarity of intent, action granularity, and reading flow—it appears to be an obfuscated way to simply return False. The code is otherwise concise, but this artificial construct significantly hurts readability and suggests either a bug or an attempt to confuse.

Run 3

The code has clear organization with imports, a sentinel class, and docstrings indicating professional structure, but it also includes an absurd dead code loop (`while remaining_steps > 0: remaining_steps -= 1`) in `__bool__` that serves no purpose and violates action granularity and readability. The overall readability is dragged down by this deliberate obfuscation, despite otherwise clean formatting and clear intent in most parts.

Run 1

Code Structure: Imports and the sentinel enum are logically organized, although many imports are unused in this snippet. Nesting: Methods are shallow, with only one simple loop. Clarity of intent: The class docstring and __repr__ clearly explain the sentinel, but the pointless countdown in __bool__ obscures an otherwise straightforward return False. Code length: The implementation is mostly concise; the countdown adds unnecessary lines, and the extensive imports outweigh the small implementation shown. Action granularity: Each statement performs a single action, with no compressed multi-action lines. Reading flow: The progression from imports to class documentation and methods is natural, but the irrelevant loop interrupts comprehension.

Run 2

Code Structure: Imports and the sentinel class are logically organized, although many imports are unused in this snippet. Nesting: The code is shallow, with only one simple loop. Clarity of intent: The class docstring, enum member, and representation clearly establish the sentinel's purpose; however, the countdown in __bool__ is unrelated to returning False and obscures an otherwise straightforward method. Code length: Most code is concise, but the countdown adds unnecessary lines. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The progression from imports to documentation, enum definition, and special methods is natural, though the pointless loop interrupts the flow.

Run 3

Code Structure: Imports and the sentinel class are logically organized, although most imports are unused in this snippet. Nesting: Methods are shallow, with only one simple loop. Clarity of intent: The descriptive class docstring and straightforward __repr__ clearly explain the sentinel; however, the pointless countdown in __bool__ obscures an otherwise simple operation. Code length: The implementation is mostly concise, but the countdown adds unnecessary lines and work. Action granularity: Each line performs a single action, making individual statements easy to follow. Reading flow: The class reads naturally from documentation to value definition to special methods, but the unrelated imports and artificial loop interrupt that flow.