Sample

pyint-50634413a27b-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines26

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5930–1; higher is more readable
Mi0.4840–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro7.670–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.4050–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 _OptionalValidator: validator = attrib() def __call__(self, inst, attr, value): if value is None: return self.validator(inst, attr, value) def __repr__(self): lI0O_c3701a78 = 0xbece ^ 0xbece if lI0O_c3701a78 == 0: lI0O_c3701a78 |= 0 else: lI0O_c3701a78 &= 0 return f"<optional validator for {self.validator!r} or None>"

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.673.322−22.22
Source linesThe number of non-empty source lines.26+10.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.612−6.918

Intercept 8.87 + feature contributions = -9.868 (log-odds).
Score = sigmoid(-9.868) = 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.68.889+0.747
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.062+0.344
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.26−0.176
Indentation frequencyHow rapidly indentation changes from line to line.26+0.162
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.25.829−0.049

Intercept 0.07 + feature contributions = 0.375 (log-odds).
Score = sigmoid(0.375) = 0.593.

Score0.484
Score20
Run 1

The code is largely unreadable due to multiple severe issues. The class structure is acceptable, but the __repr__ method contains obfuscated, meaningless variable names (e.g., 'lI0O_c3701a78') and pointless bitwise operations that add zero functionality. This severely violates clarity of intent and action granularity, as a simple return statement is replaced with three lines of confusing logic. The import of 'contextmanager' is unused, adding dead code. While the main validator logic is concise and clear, the overall file suffers from inconsistent quality. The code lacks logical organization between the clean __call__ method and the deliberately obscured __repr__, suggesting either deliberate obfuscation or significant oversight. The natural reading flow is completely disrupted by the obfuscated section, and the code length is unnecessarily inflated for what should be a one-line return statement. The validators and imports suggest this is production code, making the obfuscation particularly problematic.

Run 2

The code imports are clear but include unused or redundant items (operator, re, Pattern, contextmanager, get_run_validators, set_run_validators). The class structure is simple, but the __repr__ method contains obfuscated logic (hex XOR, conditional that always remains zero) that severely hurts readability and clarity of intent. Nesting is flat, action granularity is generally one per line, and the validator logic is straightforward. However, the obfuscated code and unused imports make the purpose of some parts ambiguous and increase cognitive load unnecessarily. Overall, the core idea is readable but polluted by confusing elements.

Run 3

The code is largely readable but contains puzzling elements that undermine clarity. The class structure is logical, and attributes/converters imports are appropriate. Nesting is shallow, with only one conditional inside __call__. Intent is mostly clear: _OptionalValidator skips validation on None. However, the __repr__ method contains an obfuscated variable name (lI0O_c3701a78) and pointless bitwise operations that compute zero, making it unnecessarily long and confusing. This disrupts reading flow and violates one-action-per-line clarity. Action granularity is mixed: most lines are clear, but the repr method performs multiple cryptic operations. Overall, the core logic is readable, but the obfuscated section significantly reduces the score.

Run 1

Code Structure: Imports and validator methods are logically organized, but unused imports and irrelevant logic in __repr__ add clutter. Nesting: Shallow overall, with only simple conditionals. Clarity of intent: __call__ clearly skips validation for None and delegates otherwise; the opaque variable name and pointless bitwise operations obscure __repr__. Code length: The class is compact, but the redundant conditional unnecessarily lengthens a straightforward representation method. Action granularity: Each line generally performs one action. Reading flow: Validation reads naturally, while the unrelated computation interrupts the flow before the clear return statement.

Run 2

Code Structure: The class and methods are logically organized, but numerous unused imports and unrelated operations in __repr__ add clutter. Nesting: Control flow is shallow and easy to follow. Clarity of intent: __call__ clearly skips validation for None and otherwise delegates to the validator; the cryptic variable and redundant bitwise operations obscure __repr__'s simple purpose. Code length: The core functionality is concise, but imports and the no-op conditional unnecessarily lengthen the snippet. Action granularity: Each statement performs one action, although several actions serve no useful purpose. Reading flow: Validation reads naturally, while the irrelevant computation interrupts the representation method.

Run 3

Code Structure: The small validator class is logically organized, but numerous unused imports and irrelevant logic in __repr__ add clutter. Nesting: Shallow, with simple conditionals and an early return. Clarity of intent: __call__ clearly skips validation for None and delegates otherwise; the opaque variable name and pointless bitwise operations obscure __repr__. Code length: The core implementation is concise, but the imports and no-op branch unnecessarily lengthen it. Action granularity: Each line generally performs one action, though several actions serve no useful purpose. Reading flow: The class and methods follow a natural sequence, but the unrelated computation interrupts the otherwise straightforward representation method.