Sample

pyint-a811d88731a4-SRC

Unmodified source class

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8620–1; higher is more readable
Mi0.5740–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6070–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.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.341−6.512

Intercept 8.87 + feature contributions = -13.577 (log-odds).
Score = sigmoid(-13.577) = 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.69.973+0.701
Indentation frequencyHow rapidly indentation changes from line to line.34+0.439
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.054+0.413
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.69+0.089
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.833 (log-odds).
Score = sigmoid(1.833) = 0.862.

Score0.574
Score20
Run 1

The code is well-structured and readable. It employs clear naming conventions (`_DeepIterable`, `member_validator`, `iterable_validator`) which make the purpose evident. The class uses the `attrs` library effectively, with a clean slot-based design. The `__call__` method is logically organized: first validating the iterable itself, then each member. The `__repr__` is slightly more complex due to conditional f-string construction, but remains understandable. Nesting is minimal, and actions are generally one per line. The docstring in `__call__` briefly explains the design choice, aiding clarity. Minor deductions: the `__repr__` logic could be simplified or commented for faster comprehension, and the import of `Pattern` from `re` appears unused, which adds slight ambiguity. Overall, the code is concise and maintains good reading flow.

Run 2

The code is highly readable. It demonstrates logical structure with a single well-named class `_DeepIterable` and clear separation of concerns between member validation and iterable validation. Nesting is minimal, with only a single conditional and a loop, both flat and easy to follow. The intent is explicit: the docstring explains why a callable class is used, and the `__repr__` method clearly describes the validator's configuration. Code length is concise, avoiding redundancy while remaining complete. Each action is on its own line, enhancing clarity. Reading flow is natural—attributes are defined first, followed by the `__call__` method implementing validation logic, then `__repr__`. Minor improvements could include more descriptive parameter names (`inst`, `attr`) or additional comments on the conditional logic, but overall the code is excellent.

Run 3

The code is generally well-structured and readable. It has clear imports, a single class with focused methods, and logical grouping of functionality. Nesting is minimal, with only one level in the __call__ method's for loop. The intent of the deep iterable validator is clear from the naming and docstring. Code length is appropriate, and action granularity is mostly one action per line. Reading flow is natural, following a logical progression from class definition to __call__ to __repr__. Minor deductions for the slightly complex conditional in __repr__ and the multi-line f-string that could be slightly clearer, but overall this is maintainable, professional code.

Run 1

Code Structure: The class cleanly separates validator configuration, validation behavior, and representation, although several imports are unused in this snippet. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Descriptive names make iterable and member validation easy to understand; however, is_callable() and optional() are not defined or imported in the shown code, and the docstring explains the callable-class design rather than the method's behavior. Code length: The implementation is concise, with reasonable multiline formatting. Action granularity: Each statement performs a single clear action. Reading flow: Configuration followed by __call__ and __repr__ is natural; the conditional string construction requires slightly more attention but remains readable.

Run 2

Code Structure: The class cleanly separates configuration, validation, and representation, though several imports are unused in this excerpt. Nesting: Control flow is shallow, with one conditional and one loop. Clarity of intent: Descriptive names make iterable and member validation easy to understand; 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: Compact overall, although the multiline conditional expression and string formatting add some visual overhead. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural order, and whitespace separates validation stages effectively.

Run 3

Code Structure: The class logically groups validator fields, 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 names make iterable and member validation clear; however, is_callable() and optional() are not defined or imported in the shown code, and the docstring explains the implementation choice rather than validation behavior. Code length: The implementation is concise, although the multiline conditional expression and string construction add minor visual overhead. Action granularity: Each statement performs a single clear action. Reading flow: Fields followed by __call__ and __repr__ provide a natural progression, with spacing separating validation stages.