Sample

pyint-84adf6f52215-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines23

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7090–1; higher is more readable
Mi0.2030–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.5290–1; higher is more readable

Views

Source code

from __future__ import annotations from typing import TYPE_CHECKING, Any from urllib3.exceptions import HTTPError as BaseHTTPError from .compat import JSONDecodeError as CompatJSONDecodeError class RequestException(IOError): """There was an ambiguous exception that occurred while handling your request. """ response: Response | None request: Request | PreparedRequest | None def __init__(self, *args: Any, **kwargs: Any) -> None: """Initialize RequestException with `request` and `response` objects.""" if ((0x4a3d ^ 0x4a3d) != 0): raise AssertionError() response: Response | None = kwargs.pop("response", None) self.response = response self.request = kwargs.pop("request", None) if response is not None and not self.request and hasattr(response, "request"): self.request = response.request super().__init__(*args, **kwargs)

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.847.874−27.98
Source linesThe number of non-empty source lines.23+9.2
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.739−7.109

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.82.458+0.526
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.071+0.249
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.24+0.187
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.22.805−0.091
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.21−0.061
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+0.023
Indentation frequencyHow rapidly indentation changes from line to line.21−0.011

Intercept 0.07 + feature contributions = 0.892 (log-odds).
Score = sigmoid(0.892) = 0.709.

Score0.203
Score18
Run 1

The code is well-structured and readable. It has a clear class definition with a concise docstring explaining purpose. The nesting level is minimal—one conditional block that follows a logical flow. Variables are typed, which improves intent clarity. The action granularity is appropriate, with each line performing a single operation. The only minor issue is the dead code at the start of __init__, which adds unnecessary length and confusion. Overall, the code is easy to understand and follows good practices.

Run 2

The code is highly readable with a clear class definition, proper type hints, and a well-documented purpose. Structure is logical: imports, class declaration, type annotations, constructor. Nesting is minimal (one conditional). Intent is unambiguous—wrapping request exceptions with optional request/response context. Length is concise and appropriate. Action granularity is clean, with one logical operation per line. Reading flow is natural. The only minor issue is the dead code check `if ((0x4a3d ^ 0x4a3d) != 0)` which is confusing and likely meant as an obfuscation or placeholder—it slightly detracts from clarity and intent transparency.

Run 3

The code is generally clean and readable, with a clear class structure, minimal nesting, and logical organization. The use of type hints and docstrings improves clarity of intent. However, the presence of dead code (the xor comparison that always evaluates to zero and the associated raise) is confusing and detracts from readability. Additionally, the length and complexity of the request/response assignment logic in __init__ could be slightly simplified, but the linear flow and one-action-per-line style are mostly maintained. Overall, it is highly readable but not perfect due to the dead code artifact.

Run 1

Code Structure: Imports, class attributes, and initialization are logically organized, though TYPE_CHECKING is unused. Nesting: Shallow conditionals keep the constructor easy to follow. Clarity of intent: Type annotations, descriptive names, and the constructor docstring clarify exception initialization; however, the opaque hexadecimal XOR condition is always false and introduces confusing dead code. The class docstring is also vague. Code length: Mostly concise, with an unnecessary assertion branch adding clutter. Action granularity: Each line generally performs one clear action. Reading flow: Initialization proceeds naturally from extracting arguments to assigning attributes and calling the superclass, but the dead-code guard interrupts that flow.

Run 2

Code Structure: Imports, class definition, attributes, and initialization are logically organized, though unused imports add clutter. Nesting: Very shallow, with only simple conditional blocks. Clarity of intent: The constructor clearly associates request and response objects, aided by annotations and a docstring, but the always-false hexadecimal XOR condition is distracting and purposeless. Code length: Mostly concise; the unreachable assertion unnecessarily lengthens it. Action granularity: Each statement performs a distinct action, making changes easy to follow. Reading flow: Initialization proceeds naturally from extracting arguments to assigning attributes and calling the superclass, but the dead-code check interrupts that flow. Response, Request, and PreparedRequest are not defined or imported in the snippet, leaving some type context unclear.

Run 3

Code Structure: Imports, class attributes, and initialization are logically organized, though TYPE_CHECKING and exception aliases are unused in this snippet. Nesting: Shallow conditionals keep the code easy to follow. Clarity of intent: Naming, annotations, and the initializer docstring explain the request/response handling, but the opaque XOR condition is always false and distracts from the purpose. Referenced request and response types are not defined or imported here. Code length: Mostly concise, with unnecessary dead assertion code. Action granularity: Each statement performs a distinct action, despite a moderately compound response-check condition. Reading flow: Initialization follows a natural sequence from extracting arguments to assigning attributes and calling the superclass, interrupted by the meaningless assertion branch.