Sample

pyint-beb0b5022b2f-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines36

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.8620–1; higher is more readable
Mi0.5750–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol15.330–20; mean of three runs
BTTF0.5680–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, node, path, count): """ We use a callable class to be able to change the ``__repr__``. """ if self.iterable_validator is not None: self.iterable_validator(node, path, count) for status in count: self.member_validator(node, path, status) def __repr__(self): defaultBalance = ( "" if self.iterable_validator is None else f" {self.iterable_validator!r}" ) return ( f"<deep_iterable validator for{defaultBalance}" 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.378−6.567

Intercept 8.87 + feature contributions = -13.633 (log-odds).
Score = sigmoid(-13.633) = 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.055+0.408
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.718+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.829 (log-odds).
Score = sigmoid(1.829) = 0.862.

Score0.575
Score20
Run 1

The code is relatively concise and uses clear naming conventions, but it suffers from readability issues. The class structure is straightforward, but the use of a callable class with an unconventional constructor pattern is slightly ambiguous without additional context. Nesting is minimal, which is good, but the `__call__` method's logic assumes an understanding of how `count` and `node` are used by the iterable validator, making intent unclear. The `__repr__` method has a formatting oddity: 'for{defaultBalance}' with no space before the iterable validator description can create confusing output (e.g., 'for iterables of...'). Action granularity is fine, but the variable `defaultBalance` is not well-named ('balance' is unclear in this context). The reading flow is disrupted by the unexplained mix of validators, count iteration, and string formatting edge cases. Overall, the code would benefit from docstrings explaining the callable behavior, clearer variable naming, and minor formatting corrections.

Run 2

The code is generally well-structured and readable. It uses clear naming, type hints via attrs, and a logical class-based approach. The __call__ method is flat and clear. However, the __repr__ method uses slightly awkward line breaks and string concatenation that reduces natural reading flow. The code length is concise but the representation logic could be simplified. Minor issues prevent a higher score.

Run 3

The code has good structure with a clear class definition and sensible attribute setup. Nesting is minimal. The `__call__` method is concise, but clarity of intent suffers due to unclear variable names like `node`, `path`, and `count`—especially `count`, which appears to be an iterable of statuses. The `__repr__` method is straightforward but slightly awkward due to the `defaultBalance` naming and string concatenation. The import lines are unnecessarily long and include an unused `import operator`, `import re`, and `from re import Pattern`, which reduces readability. Action granularity is mostly good, with one action per line. The overall reading flow is acceptable, though the class purpose could be clearer without prior context.

Run 1

Code Structure: The class is logically organized into configuration, validation, and representation methods, though several imports appear unused in this snippet. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Validator names communicate the broad purpose, but node, path, count, status, and defaultBalance are confusing or inconsistent; count is actually iterated. The docstring explains the callable-class design rather than the method's validation behavior, and is_callable and optional are not defined or imported in the shown code. Code length: The implementation is compact, although the representation formatting is somewhat fragmented. Action granularity: Each statement performs a single clear action. Reading flow: Methods follow a natural sequence, but ambiguous parameter names and unexplained dependencies interrupt understanding.

Run 2

Code Structure: The class is logically organized into attribute declarations, validation behavior, and representation, though several imports appear unused. Nesting: Control flow is shallow, with a simple conditional and loop. Clarity of intent: Validator names communicate the general purpose, but node, path, count, and status obscure their roles; count is unexpectedly iterable. The name defaultBalance is misleading and inconsistent with snake_case conventions. is_callable and optional are not defined or imported in the snippet, making attribute initialization harder to understand. Code length: The implementation is compact, although the docstring explains representation customization rather than validation behavior. Action granularity: Each statement performs a focused action, with no crowded multi-action lines. Reading flow: Methods follow a natural order and whitespace separates operations clearly, but the multiline conditional expression and split representation string slightly interrupt otherwise straightforward reading.

Run 3

Code Structure: The class cleanly separates attribute definitions, validation behavior, and representation, although several imports appear unused in this snippet. Nesting: Control flow is shallow, with a single conditional and a separate loop. Clarity of intent: Validator names and the class name convey the overall purpose, but node, path, count, status, and defaultBalance are confusing choices; notably, count is actually iterated over. The docstring explains the callable-class design rather than the validation behavior, and is_callable and optional are not defined or imported in the shown code. Code length: The implementation is compact without excessive repetition. Action granularity: Statements generally perform one action per line, and multiline expressions are formatted clearly. Reading flow: Definitions proceed naturally from configuration to behavior to representation, though ambiguous naming and missing helper context interrupt comprehension.