Sample
pyint-c2bf25a67a1f-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.769 | 0–1; higher is more readable |
| Mi | 0.248 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.697 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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
| Feature | Value | Contribution (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.
| Score | 0.248 |
|---|
| Score | 18 |
|---|
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 through clear structure, minimal nesting, and clear intent. The class HTTPProxyAuth has a single, well-documented responsibility and inherits logically from HTTPBasicAuth. The __call__ method is flat with no conditional nesting and performs one action per line: setting a header and returning the request. Variable names are descriptive, and type hints enhance clarity. The import block is organized sensibly, with standard library imports first, followed by third-party and local imports. The class docstring concisely explains the purpose. The only minor deductions are that the method modifies the request in-place without explicitly showing the beginning of the modification, and the _basic_auth_str helper function's behavior is not immediately visible—but these are negligible in the overall context. The code is concise, natural to read, and maintains clean action granularity.
Run 3
The code is highly readable with a clear, focused purpose. It uses modern Python syntax and maintains logical organization with strategic imports. The class hierarchy is intuitive (HTTPProxyAuth extends HTTPBasicAuth), and the __call__ method is concise with clear intent - attaching proxy authentication to a request. The code operates at an appropriate action granularity, with one meaningful action per line. Nesting is minimal and the reading flow is natural. The main slight deduction is that some imports appear unused at first glance (hashlib, os, re, threading, time, warnings, b64encode), which could indicate dead code or missing context, slightly reducing clarity of intent. Overall, this is exemplary readable code that follows Python best practices and would be easily understood by developers familiar with the requests library architecture.
Run 1
Code Structure: The small class and its single method are logically organized, although many imports are unused in this snippet and the base class and helper are not shown. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, method annotation, and explicit Proxy-Authorization assignment clearly communicate the purpose; the parameter name r is less descriptive. Code length: The implementation is concise, but the large import block adds unnecessary visual overhead relative to the functionality shown. Action granularity: Each line performs a single clear action. Reading flow: The method naturally proceeds from setting the authentication header to returning the request, though import clutter and limited spacing slightly weaken overall flow.
Run 2
Code Structure: The class and its method are logically organized, though many imports appear unrelated to the shown functionality. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, method signature, and explicit Proxy-Authorization header 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, but the extensive import block adds unnecessary reading overhead. Action granularity: Each statement performs a single clear action. Reading flow: The method naturally proceeds from setting the authentication header to returning the request, although the imports and limited spacing between top-level sections slightly detract from presentation.
Run 3
Code Structure: The class and its single method are logically organized, but numerous unused imports add clutter, and key dependencies 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 explicit Proxy-Authorization header clearly communicate its purpose. Code length: The implementation is concise, though 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; tighter import organization and standard spacing before the class would improve presentation.