Sample

pyint-ed645912e715-SRC

Unmodified source class

Lines40

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8560–1; higher is more readable
Mi0.7480–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6740–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, ) @attrs(slots=True, unsafe_hash=True) class _AndValidator: """ Compose many validators to a single one. """ _validators = attrib() def __call__(self, inst, attr, value): for v in self._validators: v(inst, attr, 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.765.065−25.247
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.657−6.986

Intercept 8.87 + feature contributions = -7.363 (log-odds).
Score = sigmoid(-7.363) = 0.001.

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.829+1.766
Indentation frequencyHow rapidly indentation changes from line to line.38+0.577
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.38−0.451
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.428
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.28.976−0.337
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.826+0.147

Intercept 0.07 + feature contributions = 1.785 (log-odds).
Score = sigmoid(1.785) = 0.856.

Score0.748
Score22
Run 1

The code demonstrates strong readability through clear structure and organization. Imports are logically grouped (stdlib, third-party, local) with specific naming that reveals intent. The class uses a decorator to convey its purpose concisely, and the docstring clearly explains the class's role. The `__call__` method is flat and natural to read, iterating through validators in a straightforward loop. Action granularity is appropriate—one meaningful action per line. The code is concise without being cryptic, leveraging modern Python features like `__future__` annotations and type hints appropriately. Minor deductions: the `@attrs` decorator may be unfamiliar to readers outside the attrs ecosystem, and the `_AndValidator` name with underscore suggests internal use but isn't immediately obvious without context. Overall, this is production-quality, maintainable code that reads naturally top-to-bottom.

Run 2

The code is generally readable with clear imports, type hints, and a well-documented class using attrs decorators. The structure is logical: imports, class definition, attribute declaration, and method implementation. Nesting is shallow, with only a simple for loop in the __call__ method. The intent of the _AndValidator class is clear from its name and docstring. The code is concise, avoiding unnecessary verbosity. Action granularity is appropriate—each statement is on its own line. However, the score is reduced because the method call `v(inst, attr, value)` is terse and could benefit from a more descriptive name for the validator variable `v`, and the loop variable could be more meaningful for readability. Additionally, the imports include many unused or potentially extraneous modules, which could confuse readers about dependencies. Overall, the code is readable but could be improved with minor naming and import cleanup.

Run 3

The code demonstrates good readability with a clear, logical structure. It separates imports from class definitions, uses type hints, and includes a docstring explaining the class purpose. The validation loop in __call__ is flat and single-action per line. However, the score is reduced by the unusually high number of imports (15+), suggesting potential code organization improvements like grouping related utilities into a facade module. Additionally, the class uses the @attrs decorator with slots and unsafe_hash parameters, but its attributes, methods, and overall design are not fully visible, making it hard to assess intent clarity and action granularity across the entire component.

Run 1

Code Structure: Imports are grouped logically, followed by a small, focused class, although many imports are unused in this excerpt. Nesting: Minimal nesting makes the validation loop easy to follow. Clarity of intent: The class name and docstring clearly explain validator composition; however, attrs and attrib are not imported in the shown code, and abbreviated names such as v and inst slightly reduce clarity. Code length: The class is concise, but the extensive import section overwhelms its short implementation. Action granularity: Each line performs one clear action. Reading flow: The class reads naturally from declaration to stored validators to invocation, though a blank line between the future import and standard-library imports would improve formatting.

Run 2

Code Structure: Imports and the validator class are logically separated, although many imports are unused in this snippet and attrs/attrib have no visible definitions or imports. Nesting: Shallow, with only a simple loop inside the method. Clarity of intent: The class name, docstring, and _validators field clearly communicate validator composition; abbreviated names such as v and inst slightly reduce clarity. Code length: The implementation is concise, but the extensive import section overwhelms the small class shown. Action granularity: Each statement performs one clear action. Reading flow: The class reads naturally from declaration to stored validators to invocation, though the import-heavy opening adds distraction.

Run 3

Code Structure: Imports are grouped before a small, focused class, although many imports are unused in this excerpt. Nesting: Only a single loop inside a method keeps nesting shallow. Clarity of intent: The class name and docstring clearly explain validator composition, but the abbreviated names inst, attr, and v are less descriptive, and attrs and attrib are not defined or imported in the excerpt. Code length: The implementation is concise, though the import block is disproportionately long for the shown functionality. Action granularity: Each line performs one clear action. Reading flow: The progression from imports to class declaration, stored validators, and invocation is natural, with minor spacing and context gaps.