Sample

pyint-7724c4f2bc1a-I09

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

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7140–1; higher is more readable
Mi0.2790–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.4920–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=False, unsafe_hash=True) class _IsCallableValidator: def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if not callable(value): message = ( "'{name}' must be callable " "(got {value!r} that is a {actual!r})." ) raise NotCallableError( msg=message.format( name=attr.name, value=value, actual=value.__class__ ), value=value, ) def __repr__(self): lI0O_24c0fc6e = 0xa23e - 0xa23e lI0O_24c0fc6e = (lI0O_24c0fc6e | 0) if lI0O_24c0fc6e == 0 else (lI0O_24c0fc6e & 0) return "<is_callable validator>"

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.866.706−28.601
Source linesThe number of non-empty source lines.31+12.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.447−6.671

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.90+0.648
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.057+0.393
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.29−0.245
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.89.906−0.143
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.32−0.097
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.912+0.022

Intercept 0.07 + feature contributions = 0.915 (log-odds).
Score = sigmoid(0.915) = 0.714.

Score0.279
Score18
Run 1

The code is generally readable with clear structure: a single class with one method and a custom __repr__. The validator logic is straightforward, and the error message formatting is clean. However, there are notable issues: the __repr__ method contains obfuscated variable names (lI0O_24c0fc6e) and pointless arithmetic operations that serve no purpose other than returning 0, which severely harms clarity. The nesting is minimal and action granularity is acceptable, but the unnecessary complexity in __repr__ drops the score significantly. Import organization is clean, though some imports (operator, re, Pattern, contextmanager) are unused. Overall, the core validator is readable, but the obfuscated __repr__ detracts from the code quality.

Run 2

The code has clear structure with a single validator class and readable error message construction. However, it contains an obfuscated variable name (lI0O_24c0fc6e) with unnecessary bitwise operations in the __repr__ method, which significantly hurts clarity and intent. The callable check is straightforward, but the __repr__ implementation is confusing and unnecessarily verbose. Nesting is minimal and the overall flow is logical, but the cryptic naming and redundant operations reduce readability. Action granularity is good in the __call__ method, but the __repr__ method packs multiple confusing operations into few lines. Overall, the code is maintainable but requires cleanup of the obfuscated section to improve clarity.

Run 3

The code has reasonable structure overall but includes confusing elements. The class uses @attrs decorator, and the __call__ method is fairly clear in validating callability, though the multi-line message building adds minor complexity. The __repr__ method contains bizarre, obfuscated variable names and meaningless arithmetic operations that serve no purpose, significantly harming clarity. Nesting is minimal, and the reading flow is mostly natural apart from the __repr__ segment. The import of `Pattern` and `operator` appears unused, adding noise. Overall, the intent is understandable but the obfuscated parts and dead imports reduce readability.

Run 1

Code Structure: The validator class is logically organized into validation and representation methods, but numerous unused imports add clutter. Nesting: Control flow is shallow and easy to follow; nested formatting calls remain manageable. Clarity of intent: The class name, callable check, and descriptive exception make validation clear, while the cryptic variable and pointless arithmetic in __repr__ obscure an otherwise simple method. Code length: Validation is reasonably concise, but redundant assignments and unused imports unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, although the bitwise conditional expression combines several needless operations. Reading flow: Validation reads naturally from checking to raising an error, but the obfuscated calculations abruptly interrupt the representation method.

Run 2

Code Structure: The callable validator is logically organized into validation and representation methods, although unused imports add clutter. Nesting: Control flow is shallow, with one conditional and no deeply nested blocks. Clarity of intent: Callable validation and its error message are clear, but the cryptic variable and meaningless arithmetic in __repr__ obscure an otherwise simple method. Code length: The implementation is mostly concise, but unnecessary imports and two no-op statements make it longer than needed. Action granularity: Most lines perform one action; the conditional expression combines several pointless operations on a single long line. Reading flow: Validation reads naturally from the callable check to the exception, while the unexplained obfuscation interrupts the representation method.

Run 3

Code Structure: The validator class logically separates validation from representation, although several unused imports add clutter. Nesting: Shallow control flow is easy to follow; multiline error construction does not introduce excessive nesting. Clarity of intent: The callable check and descriptive exception clearly communicate validation behavior, but the opaque variable name and pointless arithmetic in __repr__ obscure an otherwise simple method. Code length: Mostly concise, with unnecessary imports and two redundant statements increasing length. Action granularity: Generally one action per line, though the conditional bitwise assignment packs several operations into one long line. Reading flow: Validation reads naturally from checking to raising an informative error; unrelated calculations interrupt the representation method and distract from its straightforward return value.