Sample

pyint-877b5604eff7-SRC

Unmodified source class

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 Pro140–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 generally readable and well-structured. It has a clear single-purpose class hierarchy (HTTPProxyAuth extends HTTPBasicAuth), minimal nesting, and concise implementation. The __call__ method clearly expresses intent: attach proxy authentication to a prepared request. Each line performs one logical action, and the flow is natural. The imports are organized and use modern Python conventions (e.g., __future__ annotations, Final, cast). However, some imports appear unused in this snippet (e.g., hashlib, re, threading, extract_cookies_to_jar), which could confuse readers about the module's true dependencies. The class is too concise relative to the import overhead, suggesting either incomplete context or dead code. Additionally, the typing imports are heavy for such a small class, slightly reducing clarity. Minor improvements: remove or relocate unused imports, and consider whether the type-checking imports are necessary here. Overall, the code is readable but could be tightened by trimming unrelated imports.

Run 2

The code is moderately readable but suffers from several issues. The class structure is clear with a logical single-purpose class definition, but the import section is cluttered with unused imports (hashlib, os, threading, time, warnings, etc.) and redundant aliases. The nesting is flat and the method has clear intent, but the action granularity is mixed: while the method body is concise, the dense import block forces readers to scan through noise. The reading flow is disrupted by the excessive imports that don't relate to the visible code. Naming is clear (HTTPProxyAuth, __call__), and the method's purpose is evident from the docstring and implementation. The lack of type hints on __call__ parameters (self, r) reduces clarity slightly. Overall, the code is functional and straightforward but would benefit from cleaner imports and more complete type annotations.

Run 3

The code is well-structured and formatted, but it's mostly imports, making the logic hard to evaluate. The single class shown is clear: `HTTPProxyAuth` inherits from `HTTPBasicAuth` and overrides `__call__` to set a proxy authorization header. This is concise and readable, with one clear action per line. However, the code snippet lacks context—several imported modules and symbols are unused in the provided excerpt, and key logic (like `_basic_auth_str`) is not defined here. The long import block obscures the actual behavior and may signal dead or transitive imports. Overall, the visible portion is tidy and readable, but the snippet as a whole feels incomplete and partially ambiguous, limiting a higher readability score.

Run 1

Code Structure: The small class and single method are logically organized, though numerous unused 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 scan. Clarity of intent: The descriptive class name, docstring, and Proxy-Authorization assignment clearly communicate its purpose; the parameter name r is less descriptive. Code length: The implementation is concise, but the import block is disproportionately long. Action granularity: Each statement performs one clear action. Reading flow: Setting the authentication header and then returning the request creates a natural flow, slightly weakened by import clutter and missing dependencies.

Run 2

Code Structure: The class and method are logically organized, 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 explicit header assignment clearly communicate proxy authentication behavior. However, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the snippet, reducing standalone clarity. Code length: The implementation is concise, but the import section is disproportionately long for the functionality shown. Action granularity: Each statement performs one clear action. Reading flow: The method naturally progresses from setting the authentication header to returning the request; additional spacing between import groups and the class would improve visual organization.

Run 3

Code Structure: The small class and single method are logically organized, although numerous unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, and Proxy-Authorization header clearly communicate its purpose; however, HTTPBasicAuth, PreparedRequest, and _basic_auth_str are not defined or imported in the snippet, leaving some context implicit. Code length: The implementation is concise, but the import section is disproportionately long. Action granularity: Each statement performs one clear action. Reading flow: Header assignment followed by returning the request is natural, though import grouping and additional spacing before the class would improve presentation.