Sample

pyint-ff9bbb807d82-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines34

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8220–1; higher is more readable
Mi0.5530–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro70–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.640–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.34+13.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.647−6.97

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

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.66.857+0.833
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.431
Indentation frequencyHow rapidly indentation changes from line to line.32+0.37
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.32−0.313
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.67+0.277
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.35−0.203
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.33.853+0.063

Intercept 0.07 + feature contributions = 1.528 (log-odds).
Score = sigmoid(1.528) = 0.822.

Score0.553
Score22
Run 1

The code is largely unreadable due to poor structure and formatting. Multiple imports are crammed into single lines (e.g., '_get_annotations, _lazy_is_generator, get_generic_base' and exceptions grouped with trailing commas and extra spaces), making them hard to parse. The overall organization is disorganized, with no clear separation of import categories. Nesting is minimal, which is good, but clarity of intent is severely lacking: the use of '__future__', 'abc', and weak references suggests complex logic without explanation. The class definition is incomplete or intentionally abstract, and variable names like 'v', 'inst', and 'attr' are ambiguous. Action granularity is mostly one per line within the method, but the method itself is extremely terse. Reading flow is poor due to compressed imports and inconsistent spacing. Overall, the code violates basic readability principles, requiring significant effort to understand even at a superficial level.

Run 2

The code is difficult to read due to multiple factors. The imports are disorganized, with strange whitespace alignment and unnecessary line breaks (e.g., 'PY_3_11_PLUS, _lazy_is_generator' and trailing commas). The class definition uses decorators and attributes that are not imported in the provided snippet, making the intent ambiguous. The method lacks type hints and has a single-letter variable 'v', reducing clarity. Action granularity is mixed: the for loop is simple, but the overall structure lacks logical flow. Nesting is minimal, which is positive, but the tangled imports and inconsistent formatting severely hurt readability. The code appears to be part of a larger library, but as presented, it feels fragmented and hard to follow without context.

Run 3

The code structure is modular with clear imports and a simple class definition, but readability is significantly reduced by inconsistent formatting and overly compressed import statements. Nesting is flat and intent of the class is documented, yet the import block is disorganized with multiple names on one line and inconsistent spacing, forcing the reader to parse dense lists. Action granularity is generally good: __call__ keeps one action per line within the loop; however, the compressed imports violate this principle. Reading flow is disrupted by awkward line breaks and mixed formatting, making it harder to scan. Overall the code is understandable but would benefit from standard formatting (e.g., one import per line, consistent spacing) to improve readability.

Run 1

Code Structure: Imports and a focused validator class provide logical organization, but crowded import formatting and limited spacing weaken it. Nesting: Only a single loop inside a method keeps nesting shallow. Clarity of intent: The class name, docstring, and straightforward iteration clearly communicate validator composition, although abbreviated parameters and externally defined attrs/attrib require context. Code length: The implementation is concise, but the extensive imports distract from the small class shown. Action granularity: Executable statements perform one action per line; multiple imported names packed onto awkwardly spaced lines reduce scanability. Reading flow: The class reads naturally from stored validators to invocation, while inconsistent import layout and missing blank lines interrupt the overall flow.

Run 2

Code Structure: The imports and validator class are logically organized, but crowded import lists and inconsistent spacing reduce readability. Nesting: The single loop inside __call__ is shallow and easy to follow. Clarity of intent: The class name and docstring clearly communicate validator composition, though abbreviated parameters and the variable v are less descriptive. Code length: The implementation is concise, but many imports are unused in this snippet and distract from its purpose. Action granularity: Each executable line performs one clear action; multiple imported names on irregularly spaced lines add visual clutter. Reading flow: The class reads naturally from stored validators to invocation, but missing separation between the attribute declaration and method, along with inconsistent import formatting, interrupts the flow.

Run 3

Code Structure: Imports and the validator class are logically separated, although several imported symbols are unused in this snippet. Nesting: Shallow nesting makes the validation loop easy to follow. Clarity of intent: The class name and docstring clearly explain validator composition, but abbreviated parameters and the undefined attrs and attrib names reduce standalone clarity. Code length: The class is concise, while the extensive imports distract from its small implementation. Action granularity: Executable statements perform one action per line; however, multiple unevenly spaced imports on single lines hinder scanning. Reading flow: The class reads naturally from stored validators to invocation, but inconsistent import formatting and missing spacing before the method interrupt the overall flow.