Sample

pyint-d140974b8ee0-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7690–1; higher is more readable
Mi0.2480–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro17.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6970–1; higher is more readable

Views

Source code

from __future__ import annotations import hashlib import os import re import threading import time import warnings from base64 import b64encode from typing import TYPE_CHECKING, Any, Final, cast, overload from ._internal_utils import to_native_string from .compat import basestring, str, urlparse from .cookies import extract_cookies_to_jar from .utils import parse_dict_header class HTTPProxyAuth(HTTPBasicAuth): """Attaches HTTP Proxy Authentication to a given Request object.""" def __call__(self, r: PreparedRequest) -> PreparedRequest: r.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) return r

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.535.841−17.683
Source linesThe number of non-empty source lines.20+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.835−7.253

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.88+0.615
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.046+0.5
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.876−0.132
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.87.952−0.06
Indentation frequencyHow rapidly indentation changes from line to line.20−0.045
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.20−0.038

Intercept 0.07 + feature contributions = 1.202 (log-odds).
Score = sigmoid(1.202) = 0.769.

Score0.248
Score18
Run 1

The code is well-structured with clear imports, type hints, and a single, focused class. It uses modern Python features like `from __future__ import annotations` and explicit typing, which improves clarity. The class inherits from a presumably well-defined `HTTPBasicAuth` and overrides `__call__` concisely. Nesting is minimal, with only one method and one conditional-free line inside it. The purpose is unambiguous: attach proxy authentication headers. However, some imported modules (`hashlib`, `os`, `re`, `threading`, etc.) are not used in the visible snippet, which slightly reduces perceived cleanliness. The action granularity is appropriate—each line performs one logical step. Reading flow is natural, aided by the docstring and consistent naming. Overall, very readable despite minor unused imports.

Run 2

The code is highly readable due to its simple, logical structure and clear intent. The class has one concise method that performs a single action: setting a header. Nesting is flat, with no conditional or loop complexity. Naming is descriptive ('HTTPProxyAuth'), and the docstring clearly explains the class purpose. Imports are organized and separated. The only minor deduction is the use of a private helper function '_basic_auth_str' which is not defined in the snippet, slightly reducing immediate clarity for a reader unfamiliar with the module. Overall, the code is concise, follows standard Python conventions, and reads naturally from top to bottom.

Run 3

The code is highly readable with a clear, focused purpose. The structure is logical: imports are organized and the class definition is straightforward with a single, well-documented method. There is minimal nesting, and the inheritance from HTTPBasicAuth explicitly communicates intent. The action granularity is good—one meaningful operation per line—and the flow is natural. The only minor drawbacks are the large number of unused imports and type-related imports that add noise, and the reliance on an implicit base class definition rather than showing its implementation. These factors slightly reduce conciseness and immediate clarity, but overall the code is easy to understand.

Run 1

Code Structure: The class and method are logically organized, though numerous unused imports add clutter. Nesting: Minimal nesting makes the implementation easy to follow. Clarity of intent: The class name, docstring, and explicit Proxy-Authorization header clearly communicate its purpose; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the snippet, limiting standalone understanding. Code length: The implementation is concise, but the import section is disproportionate to the functionality shown. Action granularity: Each statement performs a single clear action. Reading flow: The method naturally progresses from setting the authentication header to returning the request, although the unrelated imports distract from that flow.

Run 2

Code Structure: A focused class and single method provide logical organization, though numerous unrelated imports add clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, method signature, and header assignment clearly communicate proxy authentication behavior; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the snippet, limiting standalone understanding. Code length: The implementation is concise, but unused imports unnecessarily lengthen the excerpt. Action granularity: Each statement performs one clear action. Reading flow: The method naturally progresses from setting the authorization header to returning the request, although the import block and limited spacing before the class slightly weaken presentation.

Run 3

Code Structure: The class and its single method are logically organized, but numerous unused imports clutter the snippet, and referenced dependencies are not defined or imported here. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, and explicit Proxy-Authorization header clearly communicate its purpose, although the parameter name 'r' is less descriptive than 'request'. Code length: The implementation is concise, but the import block is disproportionately long for the shown functionality. Action granularity: Each statement performs one clear action. Reading flow: The method flows naturally from setting the authentication header to returning the request; clearer import grouping and an additional blank line before the class would improve presentation.