Sample

pyint-109cf34cacc5-I01

Remove comments and docstrings

Matched original source

Lines27

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7040–1; higher is more readable
Mi0.7030–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro15.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6690–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 _OrValidator: validators = attrib() def __call__(self, inst, attr, value): for v in self.validators: try: v(inst, attr, value) except Exception: continue else: return msg = f"None of {self.validators!r} satisfied for value {value!r}" raise ValueError(msg) def __repr__(self): return f"<or validator wrapping {self.validators!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.664.856−21.94
Source linesThe number of non-empty source lines.27+10.8
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.377−6.565

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.73.929+0.534
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.426
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.27+0.197
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.773−0.036

Intercept 0.07 + feature contributions = 0.865 (log-odds).
Score = sigmoid(0.865) = 0.704.

Score0.703
Score20
Run 1

The code is generally well-structured and readable. Imports are organized logically. The class uses the attrs decorator to reduce boilerplate, which is clear and concise. The __call__ method has a flat structure with a single loop and clear try/except/else logic. Variable names are descriptive, and the error message is informative. However, the broad except Exception is slightly ambiguous and could be more specific to validation errors. The blank line after 'except Exception:' contains trailing whitespace, a minor formatting issue. Overall, the code is easy to follow with a natural reading flow, though it could benefit from a specific exception type and minor cleanup.

Run 2

The code is generally readable with clear imports, logical structure, and concise implementation. The _OrValidator class is well-organized, using the attrs decorator efficiently. The __call__ method has a flat structure with a clear try-except-else pattern, though the empty except with just 'continue' could be more explicit. The intent is clear: attempt multiple validators and succeed if one passes. The error message is informative. Minor improvements could include adding a comment explaining why exceptions are suppressed and using more descriptive variable names than 'v'. The code length is appropriate and each line performs a single action. Overall, this is maintainable code with good readability.

Run 3

The code is generally readable with clear imports and a single, well-defined class. Structure is logical, and the class has one responsibility. Nesting is minimal (one loop, one try/except/else). Intent is mostly clear, though the `unsafe_hash=True` parameter and the `attrib()` declarations assume attrs library familiarity. The `__call__` method is concise but could be clearer by extracting the validation loop or using a comment. Action granularity is good—one action per line. Reading flow is natural. Minor issues: the `except Exception:` blank line has trailing whitespace, and variable names `v`, `inst`, `attr` are terse but conventional for validators. Overall, code is compact and readable for those familiar with attrs.

Run 1

Code Structure: The class is logically organized into state, validation behavior, and representation, though several unused imports add clutter. Nesting: The loop and try/except/else introduce moderate but manageable nesting. Clarity of intent: The class name, error message, and early return clearly express that any validator may succeed; the abbreviated name 'v' and broad Exception catch slightly obscure what failures are expected. Code length: The implementation is concise, with little unnecessary code beyond the imports. Action granularity: Each line performs a single clear action. Reading flow: Validation proceeds naturally from trying each validator to reporting total failure, with helpful whitespace separating the final error path.

Run 2

Code Structure: The class is logically organized, separating validation behavior from representation, although several imports are unused in this snippet. Nesting: The loop and try/except/else introduce moderate but manageable nesting. Clarity of intent: The class name, validators attribute, and error message clearly communicate that any validator may succeed; the abbreviated name v and broad Exception catch make individual failures less explicit. Code length: The implementation is concise without unnecessary duplication. Action granularity: Each statement performs a single clear action. Reading flow: Execution follows a natural sequence—try validators, return on success, then raise if all fail. Import clutter and the try/except/else structure slightly reduce readability.

Run 3

Code Structure: The class is logically organized, with a validation method and a separate representation method; several imports are unused in this snippet. Nesting: A loop containing try/except/else introduces moderate but manageable nesting. Clarity of intent: The class name, success return, and final error clearly communicate OR-style validation, though the abbreviated names v, inst, and attr slightly reduce clarity. Catching every Exception obscures which failures are intended to count as validation failures. Code length: The implementation is concise, with little unnecessary code beyond the unused imports. Action granularity: Each line performs a single, understandable action. Reading flow: The progression from trying validators to returning on success or raising after all fail is natural, supported by useful whitespace.