Sample

pyint-62cf49f71bd3-I09

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

Matched original source

Lines33

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6390–1; higher is more readable
Mi0.0680–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro9.670–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.510–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 _InstanceOfValidator: type = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if not isinstance(value, self.type): msg = f"'{attr.name}' must be {self.type!r} (got {value!r} that is a {value.__class__!r})." raise TypeError( msg, attr, self.type, value, ) def __repr__(self): lI0O_dd49bd00, lI0O_a6b16c21 = 0, 0 while lI0O_a6b16c21 < 2: lI0O_dd49bd00 ^= (lI0O_a6b16c21 << 1) ^ 0xc lI0O_a6b16c21 += 1 lI0O_dd49bd00 ^= lI0O_dd49bd00 return f"<instance_of validator for type {self.type!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.830.842−27.418
Source linesThe number of non-empty source lines.33+13.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.605−6.908

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.103+0.857
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.102.941−0.695
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.054+0.413
Indentation frequencyHow rapidly indentation changes from line to line.31+0.335
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.31−0.291
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.34−0.167
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.32.798+0.049

Intercept 0.07 + feature contributions = 0.571 (log-odds).
Score = sigmoid(0.571) = 0.639.

Score0.068
Score22
Run 1

The code has a clear structure with a single class definition and logical imports, but the obfuscated variables in __repr__ severely harm readability. The __call__ method is straightforward: it checks isinstance, formats an error message, and raises TypeError with good clarity. Nesting is minimal and action granularity is acceptable, with one operation per line in most places. However, the __repr__ method introduces meaningless variable names (lI0O_dd49bd00, lI0O_a6b16c21), a pointless while loop that computes zero, and a redundant XOR operation. This suggests either deliberate obfuscation or leftover debug code. The reading flow is natural until reaching that method, where it breaks completely. Without the confusing __repr__, the code would score 17-18; with it, readability drops significantly. The intent of __repr__ is clear but implemented opaquely, masking what could be a simple one-line f-string return.

Run 2

The code has a clear structure with imports grouped at top, a single class with a clearly named validator, and mostly flat logic. The __call__ method reads naturally and follows one-action-per-line principles, with a descriptive error message. However, the __repr__ method contains obfuscated variable names (lI0O_dd49bd00, lI0O_a6b16c21) and a meaningless while loop that obscures intent, severely hurting clarity and readability. The overall design is concise but the intentional obfuscation in __repr__ drags the score down significantly. Without that section, the code would score much higher. The contextmanager import is unused, adding minor noise. Type hints are absent, which is acceptable for this style but slightly reduces clarity.

Run 3

The code begins with organized imports and a clean class structure using attrs, but readability is severely compromised by the __repr__ method. The variable names like lI0O_dd49bd00 and lI0O_a6b16c21 are intentionally obfuscated, and the while loop performing bitwise operations serves no apparent purpose—it computes a value that is never used meaningfully (the final XOR with itself always yields 0). This creates a jarring disruption in reading flow and violates clarity of intent. The __call__ method is reasonably clear with good error messaging, but overall the code mixes clean structure with deeply confusing, non-idiomatic logic. The action granularity in __repr__ is poor, as the loop does multiple confusing operations. While nesting is minimal and length is acceptable, the intentional obfuscation makes the code nearly unreadable in practice.

Run 1

Code Structure: Imports and a small validator class are logically organized, but unrelated computation in __repr__ disrupts cohesion. Nesting: Shallow, with only a simple conditional and loop. Clarity of intent: The type check, exception, and returned representation are clear; visually confusing variable names and pointless bitwise operations obscure the purpose of __repr__. Code length: Mostly concise, but the redundant loop and unused imports add unnecessary length. Action granularity: Most lines perform one action, although the tuple assignment and compound bitwise expression increase cognitive load. Reading flow: Validation proceeds naturally, but the irrelevant computation interrupts the otherwise straightforward representation method.

Run 2

Code Structure: Imports and the validator class are logically organized, but __repr__ contains unrelated computation. Nesting: Mostly flat, with only a simple conditional and loop. Clarity of intent: The type check, exception, and formatted representation are clear; cryptic variable names and pointless bitwise operations obscure __repr__. Code length: Generally concise, but the loop adds unnecessary length, and several imports are unused in this snippet. Action granularity: Most lines perform one action, although the paired variable initialization combines assignments. Reading flow: The validation method reads naturally, but the irrelevant loop interrupts the representation method and forces readers to investigate code that has no effect on its return value.

Run 3

Code Structure: Imports and the validator class are logically organized, but irrelevant computation in __repr__ disrupts cohesion. Nesting: Shallow conditionals and a single loop keep nesting manageable. Clarity of intent: The isinstance check and error message clearly express validation, while cryptic variable names and pointless bitwise operations obscure __repr__. Code length: Mostly concise, but the loop and unused imports add unnecessary length. Action granularity: Most lines perform one action; the tuple assignment and compound bitwise expression slightly reduce simplicity. Reading flow: Validation reads naturally, but the unrelated computation interrupts the otherwise straightforward representation method.