Sample

pyint-75a2d53ec61a-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.860–1; higher is more readable
Mi0.5560–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro150–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.5870–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, ins, att, val): """ We use a callable class to be able to change the ``__repr__``. """ if self.iterable_validator is not None: self.iterable_validator(ins, att, val) for mem in val: self.member_validator(ins, att, mem) def __repr__(self): iterable = ( "" if self.iterable_validator is None else f" {self.iterable_validator!r}" ) return ( f"<deep_iterable validator for{iterable}" 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.36+14.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 = -13.567 (log-odds).
Score = sigmoid(-13.567) = 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.70+0.7
Indentation frequencyHow rapidly indentation changes from line to line.34+0.439
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.056+0.394
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.37−0.274
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.35.789+0.09
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.49.649−0.003

Intercept 0.07 + feature contributions = 1.814 (log-odds).
Score = sigmoid(1.814) = 0.86.

Score0.556
Score20
Run 1

The code is generally well-structured and readable. It has clear separation of imports, a single class with concise methods, and low nesting. The `__call__` method is flat and straightforward. The `__repr__` method is slightly more complex due to conditional string formatting, but it is still understandable. The main deductive factors are the use of domain-specific decorators (`@attrs`, `attrib`) and validators (`is_callable`, `optional`) which assume familiarity with the codebase, and the somewhat terse variable names (`ins`, `att`, `val`, `mem`) that reduce explicit clarity. Overall, the code is logically organized, each action is on its own line, and the flow is natural.

Run 2

The code is generally well-structured with clear class and method definitions, but has several readability issues. The class uses the attrs decorator with multiple arguments which is concise but somewhat dense. The __call__ method is straightforward with clear logic, but the member_validator loop lacks descriptive variable names (ins, att, val, mem are cryptic). The __repr__ method uses nested f-strings with conditional logic that could be clearer. While the overall structure is logical and avoids deep nesting, the abbreviated parameter names reduce clarity of intent. The action granularity is mostly one action per line which is good, but some lines combine multiple operations. The reading flow is acceptable but could be improved with more descriptive naming and separation of concerns in the __repr__ method.

Run 3

The code structure is logical and follows a clear class-based design. Nesting is minimal, with only one level inside __call__. Naming is descriptive (_DeepIterable, member_validator, iterable_validator) and intent is clear. The __repr__ method uses f-strings with conditional expressions that remain readable. However, readability suffers from: (1) a slightly unclear validation flow in __call__ — the iterable_validator checks the container, but member_validator only iterates values without explicitly guarding against non-iterables; (2) the __repr__ logic, while concise, interleaves string building with conditional logic, slightly disrupting reading flow; (3) Magic methods lack explicit type hints, reducing self-documentation. The code is reasonably concise but could improve with clearer separation between validation and representation concerns. Overall, it's fairly readable for experienced Python developers familiar with attrs patterns.

Run 1

Code Structure: The class logically groups validator configuration, validation behavior, and representation, though several imports are unused in this excerpt. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive class and field names make the purpose clear, but abbreviated parameters and member names reduce clarity, and is_callable and optional are not defined or imported in the snippet. The __call__ docstring explains the class design rather than the method's behavior. Code length: The implementation is concise, although representation formatting spans several lines for a relatively simple result. Action granularity: Each statement performs one clear action. Reading flow: Configuration followed by execution and representation provides a natural progression, with whitespace separating distinct steps.

Run 2

Code Structure: The class is logically organized into attribute definitions, validation behavior, and representation, though several imports appear unused in this excerpt. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Validator names make the purpose clear, but abbreviated parameters (ins, att, val, mem) and references to is_callable and optional without visible definitions reduce standalone clarity. Code length: The implementation is concise; the multiline formatting in __repr__ is slightly elaborate but reasonable. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: Execution proceeds naturally from optional iterable validation to member validation, followed by representation logic. The docstring explains the callable-class design rather than the method's actual validation behavior.

Run 3

Code Structure: The class cleanly separates attribute definitions, validation behavior, and representation formatting, though several imports appear unused in this snippet. Nesting: Control flow is shallow, with a single conditional and a simple loop. Clarity of intent: Validator names and method behavior convey the purpose well, but abbreviated parameters (ins, att, val, mem) and externally defined helpers slightly reduce immediate clarity. Code length: The implementation is concise, although the representation formatting is spread across several lines. Action granularity: Each statement performs one clear action, making execution easy to follow. Reading flow: Definitions progress naturally from configuration to validation to display; however, the __call__ docstring explains the callable-class design rather than the method's actual validation behavior.