Sample

pyint-40b0df5d0cc5-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.760–1; higher is more readable
Mi0.260–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.7060–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, map: PreparedRequest) -> PreparedRequest: map.headers["Proxy-Authorization"] = _basic_auth_str(self.username, self.password) return map

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.838−7.257

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.90+0.648
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.045+0.504
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
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.90−0.147
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.934−0.131
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.153 (log-odds).
Score = sigmoid(1.153) = 0.76.

Score0.26
Score18
Run 1

The code is generally readable with clear naming and straightforward logic. The single class extends HTTPBasicAuth with an obvious purpose: attaching proxy authentication. The __call__ method is short and performs two clear actions, though setting the header and returning the request are on the same line, slightly reducing action granularity. Imports are organized, though some appear unused or legacy (e.g., basestring, parse_dict_header), which can create ambiguity about dependencies. The code is flat and has no nesting, which aids readability. The type hint uses 'map' as a parameter name, which is potentially confusing since 'map' is a built-in function and doesn't convey 'prepared request' clearly. Overall, the code is concise and clear but minor improvements in naming and import cleanup could enhance intent.

Run 2

The code is well-structured and readable. It uses clear imports, type hints, and a straightforward class definition. The class extends HTTPBasicAuth with a single, focused method that performs one action per line. The method name `__call__` is idiomatic for making an object callable, though the parameter name `map` is slightly misleading since it shadows the built-in and doesn't clearly indicate it's a request object. The docstring clearly states the class's purpose, and the code has no unnecessary nesting or complexity. Minor deductions for the ambiguous `map` parameter name and unused imports, which could confuse readers about actual dependencies. The overall flow is natural and concise, making the intent immediately clear.

Run 3

The code is highly readable with a clear, logical structure. It imports only necessary modules and uses type hints effectively. The class HTTPProxyAuth has a single, focused responsibility: adding proxy authentication headers. The __call__ method is concise, performing one clear action per line: setting the header and returning the modified request. There is no deep nesting, and the reading flow is natural, moving from imports to class definition to method implementation. The docstring clearly states the class purpose. Minor deductions: the parameter name 'map' shadows Python's built-in map function and could be more descriptive (e.g., 'request'), and the imports could be alphabetically organized for slightly better maintainability. Overall, the code is clean, unambiguous, and easy to understand.

Run 1

Code Structure: The class and its single method are logically organized, although many imports are unused in this snippet and referenced dependencies are not shown. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, header name, and type annotations clearly convey proxy authentication; naming the request parameter 'map' is misleading and shadows a built-in. Code length: The implementation is concise, but the import block adds unnecessary clutter for the displayed functionality. Action granularity: Each statement performs one clear action. Reading flow: Updating the authorization header and returning the request forms a natural sequence, though import clutter and limited spacing between top-level elements slightly reduce readability.

Run 2

Code Structure: The class and method are logically organized, but the many unused imports add clutter, and referenced authentication helpers and request types are not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, and header assignment clearly communicate proxy authentication; however, the parameter name 'map' is vague and shadows a built-in. Code length: The implementation is concise, though the import block is unnecessarily long for the functionality shown. Action granularity: Each statement performs one clear action. Reading flow: The method flows naturally from setting the authorization header to returning the request, but unrelated imports distract from that straightforward logic.

Run 3

Code Structure: A small class with one focused method is logically organized, but the many unused imports distract from the implementation. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, and explicit Proxy-Authorization header clearly communicate the purpose; however, naming the request parameter 'map' is misleading and shadows a built-in. HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the shown snippet, reducing self-contained clarity. Code length: The implementation is concise, though the import section is unnecessarily long for the displayed functionality. Action granularity: Each statement performs one clear action. Reading flow: The header assignment followed by returning the request reads naturally, but unrelated imports and limited spacing between top-level sections slightly weaken presentation.