Sample

pyint-05b4256d3455-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines32

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7150–1; higher is more readable
Mi0.2590–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.4370–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 _SubclassOfValidator: type = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if ((0x233 ^ 0x233) != 0): raise AssertionError() if not issubclass(value, self.type): msg = f"'{attr.name}' must be a subclass of {self.type!r} (got {value!r})." raise TypeError( msg, attr, self.type, value, ) def __repr__(self): if ((0xe3da ^ 0xe3da) != 0): raise AssertionError() return f"<subclass_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.828.27−27.333
Source linesThe number of non-empty source lines.32+12.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.442−6.663

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.939+0.598
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.063+0.333
Indentation frequencyHow rapidly indentation changes from line to line.30+0.301
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.30−0.268
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.33−0.132
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.31.761+0.034
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.97−0.018

Intercept 0.07 + feature contributions = 0.918 (log-odds).
Score = sigmoid(0.918) = 0.715.

Score0.259
Score21
Run 1

The code is generally structured and readable, but it contains some problematic elements. The class definition is clear with a reasonable __call__ method and __repr__. However, there are opaque dead-code assertions like `if ((0x233 ^ 0x233) != 0): raise AssertionError()` that add confusion and length without purpose. They break the natural reading flow and make intent ambiguous. Nesting is low, which is good, and action granularity is mostly one action per line. The error message and exception raising are clear. The import block is standard. Overall, the code would be much clearer if the dead assertions were removed; otherwise, the structure is logical and concise.

Run 2

The code is generally structured but has several readability issues. It follows standard class-based validator patterns, but includes dead-code checks like `if ((0x233 ^ 0x233) != 0)` that add confusion with no purpose, reducing clarity. Nesting is minimal, which is good. Variable names are clear, and the error message is descriptive. However, the class's `__repr__` and `__call__` methods are short, which is fine, but the import block is long and mixes standard library and internal modules without grouping, affecting flow. The conditional `if` blocks are one-liners but their bodies are redundant, hurting action granularity and intent. Overall, the core logic is understandable but unnecessary complexity and imports lower readability.

Run 3

The code follows a clear class-based validator pattern with reasonable structure, but readability is severely undermined by dead code—specifically the obfuscated `if ((0x233 ^ 0x233) != 0): raise AssertionError()` checks that add confusion and noise. These blocks obscure intent and suggest leftover debugging or anti-tampering code. Nesting is mostly flat, and action granularity is acceptable, though the `if not issubclass` block adds slight complexity. The `__repr__` method is clean, but the `__call__` method is cluttered by the dead condition and a multi-line exception raise that could be simplified. Variable names are clear, and imports appear relevant. Overall, the code is readable in its core logic, but the artificial assertions and unnecessary length reduce clarity and flow.

Run 1

Code Structure: The validator class is logically organized into validation and representation methods, although several imports appear unused in this snippet. Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: The class name, issubclass check, and descriptive error message clearly communicate the purpose, but the constant XOR checks are opaque, always false, and distracting. Code length: The implementation is fairly short, though dead assertions and the expanded exception arguments add unnecessary length. Action granularity: Statements generally perform one action per line, making individual operations easy to identify. Reading flow: Validation proceeds naturally from checking the value to constructing and raising an error, but redundant checks interrupt both methods, and the docstring explains an implementation choice rather than the method's behavior.

Run 2

Code Structure: The validator class logically separates validation and representation, but numerous unused imports add clutter. Nesting: Mostly flat, with simple conditional checks and no deep nesting. Clarity of intent: Naming and the error message make subclass validation clear, but constant-false XOR checks obscure intent, and the call-method docstring discusses representation rather than validation. Code length: Short overall, though dead assertion blocks and unused imports unnecessarily increase length. Action granularity: Statements generally perform one action per line; the multiline exception construction is easy to scan. Reading flow: Validation proceeds naturally from checking the value to constructing an error, but irrelevant assertion checks interrupt both methods.

Run 3

Code Structure: The validator class is logically organized into validation and representation methods, but numerous unused imports add clutter. Nesting: Mostly flat, with simple conditionals and no deep nesting. Clarity of intent: Class and method names make the validator's purpose clear, but constant-false XOR checks are distracting and suggest unexplained defensive logic. The __call__ docstring explains representation customization rather than validation behavior. Code length: The implementation is short, though dead checks, unused imports, and the expanded exception call add unnecessary bulk. Action granularity: Each statement performs one clear action; multiline exception arguments remain readable. Reading flow: Validation naturally proceeds from checking the value to constructing and raising an error, but irrelevant assertion branches interrupt that flow.