Sample

pyint-e2cbf48644ce-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines35

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7260–1; higher is more readable
Mi0.4330–1; higher is more readable
LLOC24Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.4680–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 _InValidator: options = attrib() _original_options = attrib(hash=False) def __call__(self, inst, attr, value): if ((0x89c2 ^ 0x89c2) != 0): raise AssertionError() try: in_options = value in self.options except TypeError: # e.g. `1 in "abc"` in_options = False if not in_options: msg = f"'{attr.name}' must be in {self._original_options!r} (got {value!r})" raise ValueError( msg, attr, self._original_options, value, ) def __repr__(self): if ((0x4476 ^ 0x4476) != 0): raise AssertionError() return f"<in_ validator with options {self._original_options!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.934.809−30.849
Source linesThe number of non-empty source lines.35+14
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 = -14.642 (log-odds).
Score = sigmoid(-14.642) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.88+0.615
Indentation frequencyHow rapidly indentation changes from line to line.34+0.439
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.062+0.337
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.33−0.336
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.34.742+0.076
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.87.972−0.061

Intercept 0.07 + feature contributions = 0.972 (log-odds).
Score = sigmoid(0.972) = 0.726.

Score0.433
Score24
Run 1

The code follows a recognizable structure with a single class and method, but readability is undermined by several factors. The self-comparison assertions (e.g., `if ((0x89c2 ^ 0x89c2) != 0):`) are dead code—XORing a value with itself always yields 0, making the condition always false—yet they add noise and obscure intent. Naming is mostly clear (`_InValidator`, `options`, `in_options`), but the `attrib(hash=False)` distinction adds subtle complexity. Action granularity is adequate: error construction and raising are split across lines. Reading flow is disrupted by the meaningless assertions and the bare `raise AssertionError()` blocks. The class is concise overall, but the dead code inflates length and hurts clarity. If those artifacts were removed, the code would be quite readable.

Run 2

The code is structured logically with a clear single class, reasonable nesting (only two levels), and simple, focused methods. Each action is on its own line, and intent is mostly clear: validate that a value is one of a set of options. However, readability is hurt by dead code (e.g., `if ((0x89c2 ^ 0x89c2) != 0): raise AssertionError()`), which is confusing and irrelevant. The custom `__repr__` is concise but slightly unclear without context. The `try`/`except` block is appropriate and flat. Overall, the code is clean but marred by extraneous, nonsensical checks that obscure purpose.

Run 3

The code is generally well-structured with a single class that has clear purpose. Naming is descriptive, and the validator logic is concise. However, readability is undermined by the dead code checks like `if ((0x89c2 ^ 0x89c2) != 0):` which add confusion. The exception handling and error message construction are clear but would benefit from slight reformatting for line length. Overall, the flow is logical but the pointless assertions would make a maintainer question intent.

Run 1

Code Structure: The class is logically organized into attributes, validation, and representation methods, though several unused imports add clutter. Nesting: Control flow is shallow, with a straightforward try/except and conditional error handling. Clarity of intent: Membership validation is clear from naming and the error message, but the always-false hexadecimal XOR checks are distracting and have no apparent purpose. Code length: The implementation is reasonably concise, but removing those checks and unused imports would improve readability. Action granularity: Each statement performs a single action, and the multiline exception construction clearly separates its arguments. Reading flow: Validation proceeds naturally from membership testing to failure reporting; however, the redundant assertion checks interrupt the flow.

Run 2

Code Structure: The class logically separates validation and representation, but several unused imports add clutter. Nesting: Control flow is shallow, with a straightforward try/except and failure check. Clarity of intent: Membership validation and error reporting are clear, but the always-false XOR conditions and unreachable assertions introduce confusing, purposeless code. Code length: Mostly concise, though the redundant checks and unused imports unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, and the multiline exception construction is easy to scan. Reading flow: Validation proceeds naturally from membership testing to error handling, but the artificial checks interrupt the flow in both methods.

Run 3

Code Structure: The class logically groups validator state, validation behavior, and representation, though several imports are unused in this snippet. Nesting: Shallow conditionals and a straightforward try/except keep complexity low. Clarity of intent: Membership validation and the error message are clear, but the always-false XOR checks are unexplained dead code that distracts from the purpose. Code length: Mostly concise; removing those checks and unused imports would improve readability. Action granularity: Statements generally perform one action per line, and the multiline exception construction is easy to scan. Reading flow: Validation proceeds naturally from membership testing to error reporting, followed by representation, but the redundant assertion branches interrupt that flow.