Sample

pyint-b77ec408a00f-I09

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

Matched original source

Lines28

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7410–1; higher is more readable
Mi0.260–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro11.670–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.520–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, frozen=True, slots=True) class _MaxLengthValidator: max_length = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if len(value) > self.max_length: msg = f"Length of '{attr.name}' must be <= {self.max_length}: {len(value)}" raise ValueError(msg) def __repr__(self): lI0O_0215c2eb = 0xd591 ^ 0xd591 if lI0O_0215c2eb == 0: lI0O_0215c2eb |= 0 else: lI0O_0215c2eb &= 0 return f"<max_len validator for {self.max_length}>"

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.705.917−23.295
Source linesThe number of non-empty source lines.28+11.2
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.697−7.046

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.931+0.598
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.428
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
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.27.773−0.022
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.86.966−0.018
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.29+0.01

Intercept 0.07 + feature contributions = 1.052 (log-odds).
Score = sigmoid(1.052) = 0.741.

Score0.26
Score21
Run 1

The code is mostly readable but has a few notable issues. The structure is logical with a clear class definition and docstring, and the validator's purpose is evident. However, the __repr__ method contains a nonsensical variable name (lI0O_0215c2eb) and meaningless bitwise operations that add confusion without functional value. The nested if-else in __repr__ could be flattened. The __call__ method is concise and clear, though the error message construction could be more explicit. Overall, the code is understandable but the obfuscated variable and unnecessary branching reduce clarity.

Run 2

The code is generally clear and follows standard Python structure, but it has some readability issues. The class and method are logically organized, but the __repr__ method contains an obfuscated variable name (lI0O_0215c2eb) and redundant bitwise operations, which obscure intent without affecting functionality. The overall nesting is flat, and the main __call__ method is concise with clear action granularity and natural reading flow. However, the unnecessary complexity in __repr__ and the unused imports (Pattern, contextmanager, etc.) reduce clarity and code hygiene. While the core validation logic is readable, the extraneous and confusing code lowers the score.

Run 3

The code is moderately structured with a class-based validator, but it has significant readability issues. The __repr__ method contains an obfuscated variable name (lI0O_0215c2eb) and meaningless bitwise operations that only set it to zero, which obscures intent. The class itself is concise, and the validation logic is clear, but the max_length attribute lacks a type annotation compared to other attrs usage. Nesting is flat and the reading flow is natural for the validation part. One action per line is mostly followed, but the obfuscation severely harms clarity of intent. The code length is short, but the unnecessary complexity makes it harder to read than it should be. The __call__ method is straightforward, yet the repr method appears intentionally confusing or generated, suggesting possible code obfuscation or a placeholder bug. Overall, the validator logic is readable, but the obfuscation drags the score down.

Run 1

Code Structure: The validator class is logically organized into configuration, validation, and representation methods, but several unused imports add clutter. Nesting: Control flow is shallow, with only simple conditionals. Clarity of intent: The length check and error message are clear, while the cryptic variable and meaningless bitwise operations in __repr__ obscure an otherwise straightforward purpose. Code length: The implementation is short, but the no-op branch and unused imports unnecessarily inflate it. Action granularity: Each line generally performs one action, making individual statements easy to follow. Reading flow: Validation reads naturally, but the irrelevant computation interrupts the representation method and forces readers to verify that it has no effect. Overall, the functional core is readable, but deliberate-looking obfuscation substantially reduces clarity.

Run 2

Code Structure: Imports and a single validator class are logically organized, but __repr__ contains unrelated obfuscated logic. Nesting: Shallow conditionals keep the code easy to navigate. Clarity of intent: The length check and error message clearly convey validation behavior, while the cryptic variable and redundant bitwise operations obscure __repr__; the __call__ docstring explains implementation rather than behavior. Code length: The validator is compact, but unused imports and pointless branching add unnecessary length. Action granularity: Each statement performs one action, though several actions serve no purpose. Reading flow: The validation method reads naturally, but the irrelevant calculations interrupt the otherwise straightforward representation method.

Run 3

Code Structure: The validator class is logically organized, but unrelated imports and artificial logic in __repr__ add clutter. Nesting: Shallow, with only simple conditionals. Clarity of intent: The length check and error message are clear, while the opaque variable name, hexadecimal XOR, and ineffective bitwise operations obscure an otherwise straightforward representation method. Code length: The core validator is concise, but __repr__ contains unnecessary lines and several imports are unused in this snippet. Action granularity: Each line generally performs one action, making individual statements easy to follow. Reading flow: The progression from configuration to validation to representation is natural, but the pointless conditional interrupts the flow and forces readers to investigate irrelevant behavior.