Sample

pyint-0ea5d5e1b756-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines21

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7990–1; higher is more readable
Mi0.2040–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6240–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.""" 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.739.345−24.398
Source linesThe number of non-empty source lines.21+8.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.726−7.09

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.82.227+0.522
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.065+0.307
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.20.805−0.119
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
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

Intercept 0.07 + feature contributions = 1.378 (log-odds).
Score = sigmoid(1.378) = 0.799.

Score0.204
Score16
Run 1

The code is highly readable with clear structure and purpose. It follows standard Python conventions with proper imports, type hints, and docstrings. The class hierarchy is logical (inherits from IOError), and the constructor clearly handles optional 'response' and 'request' parameters. Nesting is minimal (one conditional block), and the conditional logic is straightforward. Each action is on its own line, maintaining good granularity. The reading flow is natural - from argument parsing to attribute assignment to fallback logic. Minor deductions: the conditional could be slightly more explicit with parentheses for clarity, and the attribute annotations could use a comment explaining the None default. Otherwise, the code is concise, well-organized, and easy to follow.

Run 2

The code is highly readable due to its clear structure, flat nesting, and explicit intent. The class definition and docstrings provide immediate context. The __init__ method follows a logical flow: pop keyword arguments, assign attributes, conditionally infer request from response, then call super. Each line performs a single action, enhancing clarity. Type hints and future-import annotations improve maintainability. While the conditional is slightly compact, it remains understandable, and variable names are descriptive. Overall, the code balances conciseness with clarity, making it easy to follow and maintain.

Run 3

The code is clean and readable. It has a logical structure with a clear class definition and docstrings explaining intent. Nesting is minimal, with only one conditional block that is easy to follow. Variable naming is descriptive, and action granularity is appropriate—each line performs a distinct operation. The reading flow is natural, moving from attribute declarations to initialization logic. Type hints and future annotations improve clarity without adding clutter. Minor deductions for the slightly complex condition on line 17, which could benefit from a helper or comment, and the inheritance from IOError may be non-obvious to some readers.

Run 1

Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized, although several imports appear unused in this snippet. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Names, type hints, and the initializer docstring clearly explain storing request and response context; the class docstring is vague, and the truthiness check for request is less explicit than checking for None. Code length: Compact without unnecessary elaboration. Action granularity: Each statement performs one clear action. Reading flow: Initialization proceeds naturally from extracting response, assigning attributes, and deriving a missing request to initializing the superclass. Response, Request, and PreparedRequest are not defined or imported in the snippet, slightly reducing self-contained readability.

Run 2

Code Structure: Imports, class annotations, and initialization are logically organized, though several imports are unused in this snippet. Nesting: A single conditional keeps the implementation shallow. Clarity of intent: Descriptive names, type annotations, and the initializer docstring clearly communicate exception context handling; the class docstring is vague, and referenced request/response types are not defined or imported here. Code length: Compact without unnecessary implementation detail. Action granularity: Each statement performs one main action, although popping keyword arguments combines retrieval and removal idiomatically. Reading flow: Initialization proceeds naturally from extracting the response to setting request context and initializing the superclass. The compound condition requires slightly more attention but remains readable.

Run 3

Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: A single conditional keeps the code shallow and easy to follow. Clarity of intent: Descriptive names and the initializer docstring clearly communicate attachment of request and response objects, although the class docstring is vague and referenced types are not defined or imported in the snippet. Code length: The implementation is concise, but several imports are unused here. Action granularity: Each statement performs one clear action; the compound condition is readable. Reading flow: Initialization proceeds naturally from extracting the response to assigning attributes, inferring a missing request, and initializing the superclass. Additional spacing between imports and the class would improve presentation.