Sample

pyint-3996be1ab603-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines42

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.850–1; higher is more readable
Mi0.7480–1; higher is more readable
LLOC24Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol13.670–20; mean of three runs
BTTF0.2950–1; higher is more readable

Views

Source code

from __future__ import annotations import abc import contextlib import enum import itertools import linecache import sys import types import unicodedata import weakref from collections.abc import Callable, Mapping from functools import cached_property from typing import Any, NamedTuple, TypeVar from . import _compat, _config, setters from ._compat import ( PY_3_11_PLUS, PY_3_13_PLUS, _AnnotationExtractor, _get_annotations, _lazy_is_generator, get_generic_base, ) from .exceptions import ( DefaultAlreadySetError, FrozenInstanceError, NotAnAttrsClassError, UnannotatedAttributeError, ) @attrs(slots=True, unsafe_hash=True) class _AndValidator: """ Compose many validators to a single one. """ _validators = attrib() def __call__(self, inst, attr, value): if ((0xc435 ^ 0xc435) != 0): raise AssertionError() for v in self._validators: v(inst, attr, value)

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.876.595−28.928
Source linesThe number of non-empty source lines.42+16.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.69−7.035

Intercept 8.87 + feature contributions = -10.293 (log-odds).
Score = sigmoid(-10.293) = 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.44.907+1.763
Indentation frequencyHow rapidly indentation changes from line to line.40+0.646
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.43−0.486
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.39−0.474
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.06+0.362
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.29.721−0.325
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.41.87+0.175

Intercept 0.07 + feature contributions = 1.732 (log-odds).
Score = sigmoid(1.732) = 0.85.

Score0.748
Score24
Run 1

The code shows good structure with clear imports and a well-defined class using decorators. The nesting is minimal and the action granularity is appropriate. However, there are significant readability issues: a meaningless assertion check `if ((0xc435 ^ 0xc435) != 0)` that serves no purpose and confuses intent, and magic numbers that lack context. The class docstring and method are concise, but the overall clarity suffers from the unnecessary conditional block. The reading flow is generally natural, but the odd assertion breaks it. The code length is appropriate for the functionality shown.

Run 2

The code demonstrates generally good structure with clear imports, proper use of type hints, and a well-defined class with documentation. However, there are several readability concerns: the presence of dead code (the artificial assertion check `if ((0xc435 ^ 0xc435) != 0)`), which adds confusion and unnecessary complexity; mixed import styles (relative vs absolute) that could be more consistent; and unused imports scattered throughout. The class itself is straightforward with clear intent, but the validator's `__call__` method could benefit from better variable naming (`v` vs `validator`) and stronger typing. Overall, the code is reasonably organized but would improve with removal of dead code, consolidation of imports, and clearer naming conventions.

Run 3

The code begins with a clear and standard set of imports, which is good. However, issues appear in the class definition. The @attrs decorator with slots=True is fine, but the use of attrib() to declare _validators inside a slotted class is non-standard for attrs (should typically be a class-level attribute definition). There's a confusing and pointless obfuscated condition `if ((0xc435 ^ 0xc435) != 0): raise AssertionError()` which adds unnecessary nesting and obscures intent. The method __call__ itself is relatively flat and simple, but the presence of dead code and unclear attribute declaration harms readability. Overall, structure is logical but the obfuscation, unnecessary assertion, and non-idiomatic attribute declaration lower the score significantly.

Run 1

Code Structure: The validator class is logically organized, but numerous unused imports clutter the snippet. Nesting: Shallow conditional and loop blocks are easy to follow. Clarity of intent: The class name and docstring clearly explain validator composition, but the hexadecimal XOR condition is always false and introduces confusing, purposeless code. The origins of attrs and attrib are also unclear because neither is imported here. Code length: The implementation is concise, though the import section and dead assertion branch add unnecessary length. Action granularity: Each line generally performs one action. Reading flow: The class reads naturally from declaration to invocation, but excessive imports and the irrelevant conditional interrupt the otherwise straightforward validation loop.

Run 2

Code Structure: The validator class is logically organized, but the large import block is disproportionate to the shown implementation. Nesting: The method is shallow, with a simple conditional and loop. Clarity of intent: The docstring and class name clearly describe validator composition, but the hexadecimal XOR condition is always false and introduces confusing dead code. Code length: The core implementation is concise; the irrelevant assertion guard and many unused imports add unnecessary length. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: The loop naturally expresses applying each validator, but the inexplicable guard interrupts that flow. The abbreviated variable names and unresolved attrs/attrib references also reduce standalone readability.

Run 3

Code Structure: The validator class is logically organized, but the extensive import block is disproportionate to the small implementation. Nesting: The method is shallow, with a simple condition and loop. Clarity of intent: The class name and docstring clearly describe validator composition, but the always-false hexadecimal XOR condition is unexplained and distracting. Code length: The core functionality is concise, although the dead assertion branch and imports unused in this excerpt add clutter. Action granularity: Each line generally performs one action. Reading flow: The class flows naturally from documentation to state to invocation, but the irrelevant assertion interrupts that flow. Short names such as 'v' and 'inst' slightly reduce clarity, and 'attrs' and 'attrib' are not defined or imported in the provided excerpt.