Sample

pyint-4d82addd4e19-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines27

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7210–1; higher is more readable
Mi0.2610–1; higher is more readable
LLOC21Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.4480–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 _MinLengthValidator: min_length = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if ((0x949b ^ 0x949b) != 0): raise AssertionError() if len(value) < self.min_length: msg = f"Length of '{attr.name}' must be >= {self.min_length}: {len(value)}" raise ValueError(msg) def __repr__(self): if ((0x3d5 ^ 0x3d5) != 0): raise AssertionError() return f"<min_len validator for {self.min_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.769.941−25.408
Source linesThe number of non-empty source lines.27+10.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.64−6.961

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.929+0.598
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.064+0.315
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.25−0.153
Indentation frequencyHow rapidly indentation changes from line to line.25+0.128
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.28+0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.807−0.035
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.964−0.018

Intercept 0.07 + feature contributions = 0.95 (log-odds).
Score = sigmoid(0.95) = 0.721.

Score0.261
Score21
Run 1

The code is mostly structured but includes obfuscated dead-code assertions that hurt clarity. The class has a clear purpose—validating minimum length—and uses attrs decorators concisely. Nesting is minimal, and the action granularity is good, with each meaningful operation on its own line. However, the `if ((0x949b ^ 0x949b) != 0): raise AssertionError()` lines are unnecessary noise, likely injected to confuse or test, and they disrupt reading flow. Imports are unused (`operator`, `re`, `Pattern`, `contextmanager`, etc.), adding length and reducing cleanliness. The docstring in `__call__` explains intent, but the assertion blocks contradict readability. Overall, readable aside from these artificial distractions.

Run 2

The code is fairly readable but has some issues. The structure is logical with a single class, but the inclusion of unreachable assertion checks (e.g., `if ((0x949b ^ 0x949b) != 0)`) is confusing and adds noise. Nesting is flat, which is good. Clarity of intent is moderate—the validator's purpose is evident, but the odd assertions obscure it. Code length is concise, though the imports at the top include unused ones (`operator`, `re`, `Pattern`, etc.), which creates unnecessary clutter. Action granularity is mostly one action per line, though the assertion blocks are multi-line for no clear benefit. Reading flow is slightly disrupted by the assertion checks and dead code. Overall, the core logic is readable, but the extraneous elements reduce clarity.

Run 3

The code is generally understandable but contains unnecessary elements that reduce readability. The structure is logical with a single class and clear method separation, and the callable class pattern is explained via docstring. Nesting is minimal and reading flow is mostly natural. However, the presence of dead code (the XOR comparison and AssertionError checks) adds noise and obscures intent. These checks appear to be defensive artifacts but are confusing and not explained. Action granularity is mostly fine, with one action per line except for the combined message assignment and raise. The __call__ method is clear and concise, but the dead code makes the overall file longer than necessary and distracts from the actual validation logic. Clarity of intent for the validation is good, but the unexplained assertions lower the score.

Run 1

Code Structure: The validator class logically groups configuration, validation, and representation, but numerous unused imports add clutter. Nesting: Methods are shallow, with simple conditional checks. Clarity of intent: Class and attribute names clearly express minimum-length validation, and the error message is informative; however, always-false hexadecimal XOR checks obscure intent and suggest unexplained obfuscation. Code length: The core implementation is concise, but redundant assertion branches and unused imports unnecessarily extend it. Action granularity: Statements generally perform one action per line, making individual operations easy to follow. Reading flow: Validation proceeds naturally from checking length to constructing and raising an error, but meaningless checks interrupt both methods, and the callable-class docstring describes representation customization rather than the validation behavior.

Run 2

Code Structure: The validator is logically organized into initialization, validation, and representation, but unused imports add clutter. Nesting: Control flow is shallow and easy to follow. Clarity of intent: Class and attribute names clearly indicate minimum-length validation, while the XOR conditions are always false and introduce confusing, purposeless checks. The callable-method docstring explains a design choice rather than its validation behavior. Code length: The core implementation is concise, but dead checks and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action, with error-message construction separated from raising the exception. Reading flow: The standard class layout is natural, but obfuscated assertions interrupt otherwise straightforward validation and representation logic.

Run 3

Code Structure: The class logically groups validation and representation methods, but numerous unused imports add clutter. Nesting: Methods are shallow, with simple conditional checks. Clarity of intent: The class name, min_length attribute, and error message clearly convey minimum-length validation; however, constant-false hexadecimal XOR checks are distracting, and the callable-method docstring does not explain validation behavior. Code length: The functional implementation is concise, but dead assertions and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action, with message construction separated from raising the exception. Reading flow: The class follows a natural attribute-to-validation-to-representation order, but meaningless checks interrupt both methods and force readers to distinguish useful logic from noise.