Sample

pyint-383458b3e393-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines31

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.790–1; higher is more readable
Mi0.6410–1; higher is more readable
LLOC24Logical lines; fewer is more readable
DeepSeek V4 Pro10.330–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.4670–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 _OrValidator: validators = attrib() def __call__(self, inst, attr, value): if ((0x33c7 ^ 0x33c7) != 0): raise AssertionError() for v in self.validators: try: v(inst, attr, value) except Exception: # noqa: BLE001, PERF203, S112 continue else: return msg = f"None of {self.validators!r} satisfied for value {value!r}" raise ValueError(msg) def __repr__(self): if ((0x687d ^ 0x687d) != 0): raise AssertionError() return f"<or validator wrapping {self.validators!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.863.358−28.491
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.533−6.799

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

Feature contributions

FeatureValueContribution
(log-odds)
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.73.938+0.534
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.74+0.39
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.065+0.314
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.29−0.245
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.31−0.061
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.30.787+0.021

Intercept 0.07 + feature contributions = 1.322 (log-odds).
Score = sigmoid(1.322) = 0.79.

Score0.641
Score24
Run 1

The code is generally readable but has some inconsistencies. The structure is logical with clear class definition and methods. Nesting is acceptable with only one level in the try-except block. The intent of the _OrValidator is clear - it tries multiple validators and raises if none succeed. However, there are issues: dead code (XOR checks that always evaluate to false) adds noise and confusion. The code length is appropriate, and action granularity is mostly one action per line. Reading flow is natural. The exception handling with continue/else is clear but could be more concise with a helper function. The repr method is straightforward. Overall, the code is understandable but the dead code reduces clarity and should be removed.

Run 2

The code has clear structure with a single class containing two methods, and action granularity is generally one action per line. However, there are significant readability issues: pointless dead-code checks like 'if ((0x33c7 ^ 0x33c7) != 0): raise AssertionError()' which are confusing and add noise; the exception handling uses a broad 'except Exception' with noqa comments, which may obscure intent; the 'for/except/else' flow, while functional, is slightly non-obvious; and reading flow is interrupted by these dead-code blocks. The class purpose and validator behavior are understandable, but the unexplained XOR comparison and abrupt exception handling reduce clarity. Overall, readable but unnecessarily cluttered.

Run 3

The code contains deliberate obfuscation patterns that severely harm readability. Dead conditional checks like `if ((0x33c7 ^ 0x33c7) != 0): raise AssertionError()` are meaningless noise — they always evaluate to False and serve no purpose in the logic. The validator logic itself is simple, but the surrounding obfuscation makes the intent unclear. The structure is logical but marred by the inserted noise lines. Nesting is shallow, which is good, but clarity of intent is severely compromised. Code length is inflated unnecessarily by the dead assertions. Action granularity is mixed — some lines contain complete actions, while others contain only noise. Reading flow is disjointed because the reader must mentally filter out the nonsensical XOR checks to follow the actual validation logic. Without those obfuscated lines, this would rate around 15; with them, it falls to near-unreadable territory.

Run 1

Code Structure: The class is logically organized into validation and representation methods, but numerous unused imports add clutter. Nesting: The loop and try/except/else introduce moderate, manageable nesting. Clarity of intent: Trying validators until one succeeds is clear, but unexplained, always-false XOR checks distract from that purpose; the name 'v' is also less descriptive than 'validator'. Code length: The implementation is short, though dead assertion branches and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action. Reading flow: The main validation path reads naturally, with a clear failure message, but irrelevant guards interrupt both methods. Broad exception handling also obscures whether validator failures or unexpected errors are intentionally suppressed.

Run 2

Code Structure: The validator class is logically organized into validation and representation methods, but unused imports and irrelevant assertion guards add clutter. Nesting: The loop with try/except/else has moderate, manageable nesting. Clarity of intent: The class name, method calls, and failure message communicate that any successful validator is sufficient; however, opaque hexadecimal XOR conditions obscure intent, and catching every Exception hides distinctions between validation failures and unexpected errors. Code length: The core implementation is concise, but always-false guards and unused imports unnecessarily lengthen it. Action granularity: Statements generally perform one action per line. Reading flow: Validation attempts, early success, and final failure follow a natural sequence, interrupted by meaningless assertion checks.

Run 3

Code Structure: The class logically groups validation and representation behavior, but unused imports and irrelevant assertion checks add clutter. Nesting: The loop and try/except/else introduce moderate, manageable nesting. Clarity of intent: The class name, error message, and representation clearly communicate OR-style validation; however, opaque hexadecimal conditions that always evaluate to false distract from that purpose. Catching every Exception also obscures which failures are expected. Code length: The core implementation is concise, but dead checks and unused imports unnecessarily lengthen it. Action granularity: Each line generally performs one action, making individual statements easy to scan. Reading flow: The validation sequence is natural—try validators, return on success, raise if all fail—but redundant checks and the terse variable name 'v' interrupt readability.