Sample

pyint-baa3cc7c5829-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines37

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7360–1; higher is more readable
Mi0.650–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol11.670–20; mean of three runs
BTTF0.4640–1; higher is more readable

Views

Source code

from __future__ import annotations import calendar import copy import time from collections.abc import Iterator, MutableMapping from http.cookiejar import Cookie, CookieJar, CookiePolicy from typing import TYPE_CHECKING, Any, TypeVar, overload from ._internal_utils import to_native_string from ._types import is_prepared as _is_prepared from .compat import Morsel, cookielib, urlparse, urlunparse import threading class MockResponse: """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `http.cookiejar` expects to see them. """ def __init__(self, headers: Any) -> None: """Make a MockResponse for `cookiejar` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers """ if ((0x715d ^ 0x715d) != 0): raise AssertionError() self._headers = headers def info(self) -> Any: if ((0xca06 ^ 0xca06) != 0): raise AssertionError() return self._headers def getheaders(self, name: str) -> Any: if ((0x1d43 ^ 0x1d43) != 0): raise AssertionError() self._headers.getheaders(name)

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.972−32.076
Source linesThe number of non-empty source lines.37+14.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.747−7.121

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.76.974+0.437
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.059+0.367
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.78.868+0.325
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.38−0.309
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.30−0.268
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.36.775+0.104

Intercept 0.07 + feature contributions = 1.027 (log-odds).
Score = sigmoid(1.027) = 0.736.

Score0.65
Score26
Run 1

The code has a clear purpose and generally clean structure, but suffers from several readability issues. The class and methods are logically organized and the docstrings help clarify intent. However, the constant `if ((0x715d ^ 0x715d) != 0): raise AssertionError()` checks are meaningless dead code that clutter every method and severely hurt readability. The `getheaders` method lacks a return statement, making its behavior ambiguous. The import block is somewhat disorganized, mixing standard library, typing, and internal imports without clear grouping. Method bodies are flat and actions are mostly one per line, which is good. The main issues are the obfuscated debug statements, missing return, and import ordering, which significantly reduce clarity despite the otherwise straightforward structure.

Run 2

The code is generally clear and well-structured, but has several readability issues. The MockResponse class has a clear purpose and docstrings, which aids intent. However, the implementation contains puzzling no-op assertions like `if ((0x715d ^ 0x715d) != 0): raise AssertionError()` which are never true and add confusion. Naming is consistent, but the `getheaders` method lacks a return statement, making its behavior ambiguous. The imports are somewhat disorganized, with `threading` imported but unused, and `calendar`, `time`, `Iterator`, `MutableMapping`, etc., appearing unnecessary. Action granularity is generally one action per line, and nesting is flat, which improves readability. Overall, the structure is logical but the presence of dead code and missing returns reduces clarity.

Run 3

The code is generally readable with clear class naming, docstrings, and simple method structure. Import organization is logical, though several imports (time, calendar, CookiePolicy, urlparse, urlunparse, threading) appear unused, adding noise. The intent is clear for the MockResponse class, but the methods contain meaningless dead-code assertions (e.g., `if ((0x715d ^ 0x715d) != 0)`) that obscure purpose and add clutter. Nesting is flat, and line length is reasonable. However, `getheaders` has a bug—it calls `self._headers.getheaders(name)` without returning the result. The docstring is conversational but explanatory. Overall structure is fine; the dead code and missing return are the main detractors.

Run 1

Code Structure: The small wrapper class is logically organized, but numerous unused imports and an out-of-order threading import add clutter. Nesting: Methods are shallow, with only single-level conditionals. Clarity of intent: Class and method names and docstrings explain the adapter purpose, but opaque hexadecimal XOR checks obscure otherwise simple operations; these conditions are always false. Code length: The core functionality is concise, yet redundant assertion blocks and unused imports substantially inflate the snippet. Action granularity: Each statement performs one action, making individual lines easy to follow. Reading flow: Methods follow a natural initialization-and-access pattern, but repeated meaningless guards interrupt the flow. The missing return in getheaders also makes its intended behavior less clear.

Run 2

Code Structure: The small class is logically organized, but numerous unused imports and a misplaced threading import add clutter. Nesting: Methods are mostly flat, with only shallow conditional blocks. Clarity of intent: Descriptive names, type annotations, and docstrings explain the wrapper, but hexadecimal XOR checks that are always false obscure otherwise simple operations. The missing return in getheaders also makes its intended behavior less clear. Code length: The implementation is short overall, yet redundant checks and imports unnecessarily inflate it. Action granularity: Each statement performs a single action, making individual lines easy to follow. Reading flow: The constructor and accessor methods follow a natural sequence, but repeated meaningless assertions interrupt that flow, and limited spacing between imports and the class reduces visual organization.

Run 3

Code Structure: The class and its small methods are logically organized, but numerous unused imports and repeated dead assertions introduce clutter. Nesting: Shallow overall, though each unnecessary conditional adds avoidable nesting. Clarity of intent: Descriptive names and docstrings explain the adapter’s purpose, but hexadecimal XOR checks obscure otherwise simple operations. getheaders also calls the underlying method without returning its result, making its intended behavior unclear. Code length: Excessive relative to the minimal functionality because of unused imports and redundant checks. Action granularity: Statements generally perform one action per line, which supports readability. Reading flow: Methods follow a natural progression, but repeated meaningless assertions interrupt the flow, and inconsistent import grouping and extra parentheses add distraction.