Sample

pyint-45c1c25a3bfc-I06

Invert eligible conditions and exchange their branches

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.670–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 demonstrates excellent readability. It follows a clean modular structure with clear imports, proper use of type hints, and well-organized class hierarchy. The nesting is minimal with only one class and one method, both flat and easy to follow. The intent is immediately clear - implementing proxy authentication that attaches headers to requests. The code is concise without being cryptic, avoiding unnecessary verbosity. Each meaningful action (setting the header and returning the request) is on its own line, maintaining good action granularity. The reading flow is natural: imports, base utilities, class definition, clear docstring, and straightforward method implementation. The only minor deductions are for the numerous imports that aren't all used in this snippet and the slight ambiguity about HTTPBasicAuth's implementation, which requires context to fully understand.

Run 3

The code demonstrates good readability with a clear, single-purpose class that follows modern Python practices. The structure is logical and flat, with no unnecessary nesting. The class name HTTPProxyAuth and its __call__ method clearly communicate intent—attaching proxy authentication to a request. The method is concise, performing one logical action (setting the header) followed by returning the request, with each statement on its own line. The reading flow is natural: imports are organized, the class has a descriptive docstring, and the implementation is straightforward. Minor deductions come from the unused imports (e.g., hashlib, os, threading, etc.) which add unnecessary length and could confuse readers about actual dependencies. Overall, the code is highly readable with clear naming, minimal complexity, and a focused implementation that follows idiomatic patterns.

Run 1

Code Structure: The class and method are logically organized, but numerous unrelated imports add clutter, and HTTPBasicAuth, PreparedRequest, and _basic_auth_str 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 Proxy-Authorization assignment clearly communicate the purpose; the parameter name r is less descriptive. Code length: The implementation is concise, though most imports are unused in the shown code. Action granularity: Each statement performs one clear action. Reading flow: Setting the authentication header and returning the request is natural and straightforward, but import clutter and insufficient spacing between top-level sections slightly interrupt the flow.

Run 2

Code Structure: A focused class and short method provide clear organization, though the large import block is disproportionate and mostly unused in this snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, and Proxy-Authorization assignment clearly communicate the purpose; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported here, limiting standalone understanding. Code length: The implementation is concise, but unnecessary imports add clutter. Action granularity: Each line performs one clear action. Reading flow: The method naturally proceeds from setting the authentication header to returning the request, although import clutter and limited spacing between top-level elements slightly reduce readability.

Run 3

1. Code Structure: The authentication behavior is cleanly encapsulated in a class and method, although the numerous unused imports clutter this snippet. 2. Nesting: Minimal nesting makes the code easy to follow. 3. Clarity of intent: The class name, docstring, method signature, and explicit Proxy-Authorization header clearly communicate the purpose. However, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported here, requiring external context. 4. Code length: The implementation is concise, but the import section is disproportionately long for the functionality shown. 5. Action granularity: Each statement performs one clear action. 6. Reading flow: The method naturally proceeds from setting the authentication header to returning the request; additional spacing between import groups and the class would improve presentation.