Sample

pyint-5d5c88e0b604-I01

Remove comments and docstrings

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.4320–1; higher is more readable
Mi0.3450–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro15.670–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.6950–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): 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.527.536−17.409
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.8−7.2

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.051+0.444
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 = -0.273 (log-odds).
Score = sigmoid(-0.273) = 0.432.

Score0.345
Score17
Run 1

The code is highly readable due to its clear structure, minimal nesting, and explicit intent. The import block is organized and uses modern Python features like `from __future__ import annotations`. The class `HTTPProxyAuth` inherits logically from `HTTPBasicAuth`, and the `__call__` method is concise with one clear action per line. The method name and parameter type hint (`r: PreparedRequest`) clearly convey intent. The return statement is straightforward. The only minor drawbacks are some unused imports (e.g., `hashlib`, `os`, `re`, `threading`, `time`, `warnings`, `b64encode`, `cast`, `overload`) and the use of `basestring` (compatibility alias) which may slightly reduce clarity for newer Python users, but these don't significantly impact the core logic's readability.

Run 2

The code has some positive readability aspects: it includes future annotations, static typing, and a clear class inheritance. The method is short and each action is on its own line. However, there are notable issues: the intent of HTTPProxyAuth is not explained, and the logic leverages an external function (_basic_auth_str) and other imports that are not shown, making the snippet incomplete. The blank line after the class declaration breaks flow, and the class docstring is missing. The import block is extensive and includes unused or unclear imports (e.g., warnings, threading, time), which adds noise. The method name __call__ is idiomatic but less explicit than a named method. Overall, it is understandable but lacks explanatory context and could be more self-contained, reducing its clarity.

Run 3

The code is generally well-structured, with clear imports and a concise class definition that extends HTTPBasicAuth. The __call__ method has a clear purpose: adding Proxy-Authorization headers. Nesting is flat, and action granularity is appropriate—one assignment and one return statement per line. However, there are minor readability issues: a large blank space inside the class before __call__ is unnecessary, and the code could benefit from a short docstring explaining the class's purpose. Additionally, while the method body is concise and readable, the overall excerpt lacks context about _basic_auth_str and PreparedRequest, which slightly reduces clarity. Overall, it's functional and easy to follow but could be improved with documentation and minor formatting cleanup.

Run 1

Code Structure: The class and method are logically organized, but numerous unused imports add clutter, and referenced names are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: HTTPProxyAuth and the Proxy-Authorization header clearly communicate the purpose. Code length: The implementation is concise, although the import block and extra blank lines are unnecessary for the shown functionality. Action granularity: Each statement performs one clear action. Reading flow: The method flows naturally from setting the authorization header to returning the request, but the unrelated imports distract from the core logic.

Run 2

Code Structure: The small class and method are logically organized, but numerous unused imports add clutter, and the base class and helper are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name and Proxy-Authorization assignment clearly communicate proxy authentication, though understanding the inherited credentials and helper requires external context. Code length: The implementation is concise, but the import block is disproportionately long. Action granularity: Each statement performs one clear action. Reading flow: The method flows naturally from setting the header to returning the request; excessive blank space and unrelated imports mildly disrupt the overall presentation.

Run 3

Code Structure: The class and its single method are logically organized, but numerous unused imports add clutter, and the base class and helper are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, method signature, and Proxy-Authorization header clearly convey proxy authentication, though the parameter name 'r' is terse. 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 naturally sets the authentication header and returns the request; excess blank lines and unrelated imports slightly disrupt the overall flow.