Sample

pyint-1afd7de48f1b-I01

Remove comments and docstrings

Matched original source

Lines34

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7830–1; higher is more readable
Mi0.5610–1; higher is more readable
LLOC19Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6020–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): 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.909.661−30.019
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.33−6.496

Intercept 8.87 + feature contributions = -14.045 (log-odds).
Score = sigmoid(-14.045) = 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.63.971+0.956
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.059+0.365
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.708+0.061

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

Score0.561
Score19
Run 1

The code is generally readable with clear class structure and logical organization. The use of the attrs library reduces boilerplate meaningfully. Nesting is minimal, and action granularity is reasonable—most lines perform a single logical operation. Naming is fairly descriptive (e.g., _DeepIterable, member_validator, iterable_validator). However, clarity of intent could be improved: the __call__ method’s purpose is not immediately obvious without context, and the __repr__ string concatenation is somewhat awkward due to the empty string and conditional f-string, making the reading flow slightly unnatural. The import list includes several unused imports (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators, _AndValidator, and_, default_if_none, NotCallableError), which adds noise and suggests potential cleanup. The class is concise overall, but the need to infer the validator behavior and the fragmented repr construction detracts from readability. Still, the flat structure and reasonable line length keep it above average.

Run 2

The code is highly readable with clear structure and logical organization. It uses decorators and typing flows naturally, with a single-purpose class handling deep iterable validation. Nesting is minimal, mostly flat, with one small conditional in __repr__. Intent is clear from naming and docstring-free but self-explanatory methods. Code length is concise without being cryptic. Action granularity is one action per line in most places, especially in __call__ and __repr__. Reading flow is natural: imports, class definition, constructor attributes, then methods in logical order. Minor deductions: slight ambiguity in __call__ regarding why iterable validation happens before member iteration (no comment), and the conditional formatting in __repr__ slightly interrupts flow, but those are minor. Overall, near-exemplary readability.

Run 3

The code is well-structured with clear separation of concerns: imports are organized, class attributes use helper functions, and methods have single responsibilities. Nesting is minimal, with only one conditional block inside __call__ and a ternary in __repr__ that remains readable. Intent is evident from names like _DeepIterable, member_validator, and iterable_validator. The code is concise, though the __repr__ method could be slightly simplified. Each logical action occupies its own line, especially in the conditional and loop. Reading flow is natural—validation logic precedes representation logic, and the conditional structure follows a clear if/then pattern. Minor deductions: the __repr__ string formatting is somewhat fragmented, and the blank line after the method signature is unnecessary. Overall, this is a clean, idiomatic implementation that balances clarity with brevity.

Run 1

Code Structure: The class cleanly separates configuration, validation behavior, and representation, though several imports appear unused in this excerpt. Nesting: Shallow conditionals and a single loop make control flow easy to follow. Clarity of intent: Descriptive validator names clearly communicate iterable and member validation; however, is_callable() and optional() are not defined or imported in the provided snippet. Code length: Compact overall, with slightly verbose formatting in __repr__ and an unnecessary blank line. Action granularity: Each statement performs one clear action. Reading flow: Configuration naturally precedes execution and representation, although the conditional string construction requires a little extra attention.

Run 2

Code Structure: The class logically separates configuration, 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: Descriptive names make iterable and member validation clear; however, is_callable() and optional() are not defined or imported in the shown code. Code length: The implementation is concise, although the multiline attribute declaration and representation formatting add some visual overhead. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order, and validation proceeds predictably from the iterable to its members. An extra blank line in __call__ and the split representation string slightly interrupt an otherwise smooth reading experience.

Run 3

Code Structure: The class logically groups validator configuration, validation behavior, and representation, although several imports are unused in this snippet. Nesting: Control flow is shallow, with a single conditional and a simple loop. Clarity of intent: Descriptive names make iterable and member validation easy to understand; however, is_callable and optional are referenced without definitions or imports in the provided code. Code length: The implementation is concise, though the multiline conditional expression and string construction make __repr__ slightly more cumbersome than necessary. Action granularity: Each statement performs one clear action, with no compressed or compound statements. Reading flow: Configuration followed by __call__ and __repr__ provides a natural progression. Minor formatting inconsistencies, including a whitespace-only line, slightly reduce polish.