Sample

pyint-b455386c2ff0-SRC

Unmodified source class

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.670–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 well-structured with clear separation of concerns. It uses a flat structure with minimal nesting, making it easy to follow. The intent is clear: handling ambiguous request exceptions and associating request/response objects. The code is concise, with each line performing a single logical action. Reading flow is natural, with the constructor logic progressing logically from extracting parameters to setting attributes and falling back to the response's request. Type hints improve clarity without adding noise. The only minor deductions are for the slightly dense conditional line and reliance on kwargs without explicit signature, which slightly reduces immediate understandability, but overall it is highly readable and maintainable.

Run 2

The code is highly readable with a clear, logical structure. It defines a custom exception class with a straightforward __init__ method. Nesting is flat and the flow is natural: pop response, assign request, infer request from response if needed, then call super. The intent is explicit—initialize a RequestException with associated request and response objects. Variable names are descriptive, and type hints (with TYPE_CHECKING) improve clarity. The code is concise without being overly compressed; each logical step is on its own line. The docstrings explain both the class and the method purpose, reducing ambiguity. The use of `hasattr(response, 'request')` is a clean guard against missing attributes. Minor points: the type annotations reference types not imported in the snippet (Response, Request, PreparedRequest), suggesting external definitions, but this does not materially affect readability within the given scope.

Run 3

The code is well-structured and highly readable. It follows a logical organization with clear class hierarchy, type hints, and a concise docstring explaining purpose. The __init__ method handles request/response extraction cleanly with minimal nesting and clear intent. Action granularity is reasonable—each line performs one meaningful action. The conditional line is slightly long but still readable. Reading flow is natural, moving from attribute definitions to initialization logic. Minor improvements could include breaking the conditional into multiple lines for clarity, but overall the code is maintainable and easy to understand.

Run 1

Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: Only one shallow conditional keeps complexity low. Clarity of intent: Descriptive names, type hints, and the initializer docstring clearly explain request/response handling, though the class docstring is vague and referenced types are not defined or imported in the snippet. Code length: Compact and appropriately scoped, with a few unused imports adding minor clutter. Action granularity: Each line generally performs one clear action. Reading flow: Initialization proceeds naturally from extracting the response to assigning attributes, inferring the request, and initializing the superclass. Additional blank lines between import groups and the class would improve visual separation.

Run 2

Code Structure: Imports, class documentation, attribute annotations, and initialization are logically organized. Nesting: A single conditional keeps the code flat and easy to follow. Clarity of intent: Descriptive names, type hints, and the constructor docstring clearly convey request/response initialization, though the class docstring is vague and Response, Request, and PreparedRequest lack visible imports. Code length: Concise overall, but several imports are unused in this snippet. Action granularity: Each statement performs one clear action; the conditional combines related checks appropriately. Reading flow: Initialization progresses naturally from extracting response and request to inferring a missing request and initializing the superclass. Additional spacing between imports and the class would improve visual separation.

Run 3

Code Structure: Imports, class annotations, and initialization are logically organized. Nesting: A single conditional keeps nesting shallow. Clarity of intent: Descriptive names and the initializer docstring make exception initialization clear, although the class docstring is vague and Response, Request, and PreparedRequest are not defined or imported in the snippet. Code length: Compact, with little unnecessary code; TYPE_CHECKING and BaseHTTPError are unused here. Action granularity: Each statement performs one main action. Reading flow: Initialization proceeds naturally from extracting the response to assigning the request, applying a fallback, and initializing the superclass. The compound conditional slightly increases reading effort.