Sample

pyint-886845866e8c-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines40

Scores

MethodScoreScale
Posnett0.0150–1; higher is more readable
Dorn0.7830–1; higher is more readable
Mi0.6850–1; higher is more readable
LLOC23Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.7190–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): 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.659.075−21.749
Source linesThe number of non-empty source lines.40+16
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.868−7.302

Intercept 8.87 + feature contributions = -4.182 (log-odds).
Score = sigmoid(-4.182) = 0.015.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.034+0.61
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.77.902+0.452
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Indentation frequencyHow rapidly indentation changes from line to line.32+0.37
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.77.951+0.364
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.32−0.313
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.861+0.147

Intercept 0.07 + feature contributions = 1.284 (log-odds).
Score = sigmoid(1.284) = 0.783.

Score0.685
Score23
Run 1

The code demonstrates good readability with clear structure, flat nesting, and logical organization. Imports are grouped and alphabetized, though some unusual formatting (random alignment in parenthesized imports) slightly hurts visual consistency. The _Nothing enum class is well-documented with a clear docstring explaining its purpose and version changes. Methods are concise with single responsibilities and clear intent. Line length is reasonable and the class hierarchy is straightforward. Minor deductions for cosmetic import inconsistencies and the somewhat dense packing of import statements, but overall this is clean, maintainable code with good separation of concerns and natural reading flow.

Run 2

The code is highly readable with clear logical organization. Imports are grouped with standard library, third-party, and local modules separated by blank lines. The class _Nothing uses an enum for a sentinel value, which is a clean pattern. The docstring is informative and version-change notes maintain context. Methods (__repr__, __bool__) follow a flat, single-action-per-line structure with minimal nesting. Naming is explicit and intent is clear. Minor readability deductions come from the slightly unusual import formatting (multiple items in parentheses with irregular spacing), which slightly disrupts natural reading flow. Overall, this is well-structured, concise, and easy to follow.

Run 3

The code is generally readable and well-structured. Imports are logically organized (stdlib, third-party, local) despite some unusual alignment in the import blocks. The _Nothing class is clear with a helpful docstring explaining its purpose, and methods are short with single actions. There is minimal nesting and the enum-based sentinel pattern is idiomatic. However, readability is slightly reduced by: inconsistent import formatting (mixed spacing), multi-line imports that could be more consistently aligned, and the docstring's versionchanged directives that add noise to the class definition. The module imports many names in a single statement, making it harder to trace dependencies. Overall, the code is maintainable and intentions are clear, but minor formatting inconsistencies prevent a higher score.

Run 1

Code Structure: Imports precede a clearly defined sentinel enum, providing logical organization, though import formatting is inconsistent. Nesting: The class and its small methods have minimal, easy-to-follow nesting. Clarity of intent: The descriptive docstring explains why the sentinel exists, and the methods clearly define its representation and boolean behavior. Code length: The implementation is concise; imports dominate this excerpt and are largely unused here, adding visual overhead. Action granularity: Statements generally perform one action per line, although several imported names are crowded onto shared lines. Reading flow: The progression from imports to documentation to implementation is natural, but irregular spacing and limited blank-line separation interrupt readability.

Run 2

Code Structure: Imports precede a clearly defined sentinel enum, providing logical organization, though import formatting and spacing are inconsistent. Nesting: Minimal nesting makes the class and methods easy to follow. Clarity of intent: The descriptive docstring explains the sentinel's purpose, and __repr__ and __bool__ have straightforward behavior. Code length: The implementation is concise; the numerous imports are unused in this excerpt and add visual overhead. Action granularity: Most lines contain one action, but several imported names are awkwardly grouped on single lines. Reading flow: The progression from imports to documentation to implementation is natural, but irregular indentation in import lists and missing blank lines slightly interrupt scanning.

Run 3

Code Structure: Imports precede a clearly defined sentinel class, but inconsistent grouping and spacing weaken organization. Nesting: Very shallow, with simple methods and no nested control flow. Clarity of intent: The descriptive class docstring explains the sentinel's purpose, and both methods have obvious behavior. Code length: The implementation is concise; the import block is relatively large for this excerpt, though its broader usage is unknown. Action granularity: Executable statements generally perform one action per line, but several imported names are awkwardly packed together. Reading flow: The progression from imports to documentation to implementation is natural, but malformed-looking import formatting and missing blank lines around the class and first method interrupt readability.