Sample

pyint-d350ff545b54-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8360–1; higher is more readable
Mi0.4410–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro100–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.5670–1; higher is more readable

Views

Source code

import operator import re from contextlib import contextmanager from re import Pattern from ._config import get_run_validators, set_run_validators from ._make import _AndValidator, and_, attrib, attrs from .converters import default_if_none from .exceptions import NotCallableError @attrs(repr=False, slots=True, unsafe_hash=True) class _DeepIterable: member_validator = attrib(validator=is_callable()) iterable_validator = attrib( default=None, validator=optional(is_callable()) ) def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if self.iterable_validator is not None: self.iterable_validator(inst, attr, value) for member in value: self.member_validator(inst, attr, member) def __repr__(self): iterable_identifier = ( "" if self.iterable_validator is None else f" {self.iterable_validator!r}" ) return ( f"<deep_iterable validator for{iterable_identifier}" f" iterables of {self.member_validator!r}>" )

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.919.264−30.336
Source linesThe number of non-empty source lines.31+12.4
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.334−6.501

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.88+0.615
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.054+0.414
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
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.87.938−0.059
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.775+0.02

Intercept 0.07 + feature contributions = 1.628 (log-odds).
Score = sigmoid(1.628) = 0.836.

Score0.441
Score20
Run 1

The code has severe readability issues. The indentation is inconsistent and broken—there are misaligned continuation lines and missing spaces around braces. The class structure combines `attrs` decorator parameters, attributes, and methods without adequate spacing or separation, making it difficult to parse. The `__call__` method contains a multi-line docstring that interrupts control flow mid-function, and the nested validator logic is not clearly separated from the iteration logic. The `__repr__` method has its return statement split awkwardly with inconsistent line breaks and parenthesis placement. Multiple actions are packed into single lines in the `attrib()` declarations, and the lack of blank lines or comments between logical blocks (attributes, call, repr) obscures intent. The combination of deep nesting inside `__repr__` with conditional expressions and f-strings further reduces clarity. Overall, the code appears syntactically broken and would be extremely difficult to maintain or understand.

Run 2

The code is moderately readable but has structural and stylistic issues. The class is logically organized with clear methods, but the constructor has inconsistent formatting: the `attrib` call for `iterable_validator` is awkwardly broken across lines with odd indentation. The `__repr__` method's return statement is split in a confusing manner, with an unnecessary parenthesized f-string. While there is minimal nesting and each method performs a single action, the line breaks and alignment reduce readability. The intent of the class is fairly clear—it's a validator for iterables—but the formatting choices make the code feel disorganized and distract from comprehension. Some expressions, like the conditional f-string construction, are clear, but the overall visual rhythm is disrupted by inconsistent spacing and line breaks.

Run 3

The code is generally well-structured and readable. It follows a logical class definition with clear attributes using `attrs`. Nesting is minimal and controlled. The intent is clear: a deep iterable validator. The code is concise and each line typically performs one action. However, a few formatting issues slightly reduce readability: the `iterable_validator` attribute definition spans multiple lines awkwardly with inconsistent indentation, and the return statement in `__repr__` has an unusual line break and leading spaces. These small formatting quirks interrupt the natural reading flow. Overall, the code is maintainable and clear, but could benefit from cleaner line breaks and more consistent formatting to achieve a higher score.

Run 1

Code Structure: The class logically groups validator attributes, validation behavior, and representation, though several imports are unused in this snippet. Nesting: Shallow conditionals and a simple loop make execution easy to follow. Clarity of intent: Descriptive names clearly communicate iterable and member validation, but is_callable and optional are not defined or imported in the snippet, and the __call__ docstring describes the class design rather than the method's behavior. Code length: The implementation is compact without excessive logic. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order, but missing blank lines and irregular spacing in attribute initialization and the return expression interrupt readability.

Run 2

Code Structure: The class logically groups validator configuration, validation behavior, and representation, though minimal spacing between methods weakens separation. Nesting: Shallow conditionals and a single loop make execution easy to follow. Clarity of intent: Descriptive names clearly communicate iterable and member validation; however, is_callable and optional are not defined or imported in the snippet, and the call-method docstring explains the class design rather than the method's behavior. Code length: The implementation is compact, but several apparently unused imports add clutter. Action granularity: Statements generally perform one action per line, supporting readability. Reading flow: Validation proceeds naturally from checking the iterable to checking its members, followed by representation logic. Irregular spacing and awkward line breaks in the attribute declaration and return statement interrupt an otherwise straightforward flow.

Run 3

Code Structure: The class logically groups validator configuration, validation behavior, and representation, though minimal spacing between methods reduces separation. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Descriptive names clearly communicate iterable and member validation; however, is_callable and optional are not defined or imported in the snippet, and the docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, but several apparently unused imports add clutter. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Validation proceeds naturally from the iterable to its members, followed by representation formatting. Inconsistent whitespace, awkward line wrapping around attrib and return, and missing blank lines between methods interrupt otherwise straightforward reading.