Sample

pyint-b51c1223fae8-I11

Split eligible integer literals into pairs of short-named intermediate 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 Pro15.330–20; mean of three runs
GPT-6.1 Sol17.330–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: imports are logically grouped (standard library, typing, internal modules), class and method names clearly express intent, and the class docstring succinctly explains its purpose. The method body is flat, concise, and performs one action per line—setting a header and returning the prepared request. Type hints, final/overload imports, and future annotations indicate careful structure. Minor deductions for unused imports (hashlib, os, re, threading, time, warnings, b64encode, cast, overload, etc.) which reduce clarity slightly, but overall the organization and flow are excellent.

Run 3

The code demonstrates moderate readability but suffers from unnecessary complexity. The class structure is logical and the __call__ method has clear intent with single-action granularity. However, the excessive imports—many of which appear unused for this specific class definition—clutter the beginning and obscure the actual purpose. The presence of TYPE_CHECKING, Final, overload, and various utility imports without context creates ambiguity about dependencies. Deep inheritance (HTTPProxyAuth extends HTTPBasicAuth) is straightforward, but the nesting is acceptable. The main readability issue is the disproportionate import block relative to the tiny class body, making the file feel longer than necessary. While the actual method is concise and clear, the overall structure lacks cohesion because unrelated imports distract from the core logic. Better import organization or placement of this class within a larger module would improve clarity, as would removing speculative imports. The code itself is clean, but its isolated presentation with excessive dependencies reduces its readability score.

Run 1

Code Structure: The class and method are logically organized, but numerous unrelated imports clutter the snippet, and required symbols such as HTTPBasicAuth and _basic_auth_str are not defined or imported here. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, method signature, and explicit Proxy-Authorization header clearly convey its purpose. Code length: The implementation is concise, although the unused imports add unnecessary length. Action granularity: Each statement performs one clear action. Reading flow: The method naturally proceeds from setting the authentication header to returning the request; however, the excessive import block and missing dependencies interrupt understanding of the snippet as a standalone unit.

Run 2

Code Structure: The class and its single method are logically organized, but numerous unused imports add clutter. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, and explicit Proxy-Authorization assignment clearly communicate its purpose; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the snippet. Code length: The implementation is concise, although the import section is disproportionately long. Action granularity: Each statement performs one clear action. Reading flow: The method flows naturally from setting the authentication header to returning the request, but unrelated imports and limited spacing between top-level sections slightly disrupt readability.

Run 3

Code Structure: A small, logically organized class with a focused method, though numerous unused imports clutter the snippet. Nesting: Minimal nesting makes the implementation easy to scan. Clarity of intent: The class name, docstring, method signature, and explicit header assignment clearly convey proxy authentication; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the shown code. Code length: The implementation is concise, but the import section is disproportionately long. Action granularity: Each line performs a single clear action. Reading flow: Header assignment followed by returning the request is natural and straightforward; additional spacing between import groups and the class would improve presentation.