Sample
pyint-df041c92f2b5-I05
Rewrite eligible decimal integer literals in hexadecimal notation
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 | 16.33 | 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 is well-structured with clear imports, a concise class definition, and a straightforward method. The intent is unambiguous: attach proxy authentication headers. The method is flat with no nesting and each line performs a single action, enhancing readability. However, minor deductions apply because the code lacks context for some imported utilities (e.g., _basic_auth_str is undefined in the snippet), and type hinting could be more explicit (e.g., return type for __call__ is missing). The overall flow is natural, but the mixed use of typing and compatibility imports slightly obscures clarity. Despite these minor gaps, the code is highly readable for a focused utility.
Run 3
The code is generally readable with clear structure: imports are organized, the class has a documented purpose, and the __call__ method is concise with a single logical action. The method body uses flat nesting and clear intent. However, readability is slightly reduced by the unused imports (hashlib, os, re, threading, time, warnings, b64encode, TYPE_CHECKING, Any, Final, cast, overload, to_native_string, basestring, str, urlparse, extract_cookies_to_jar, parse_dict_header) which clutter the top of the file and obscure which dependencies are actually needed. The method name __call__ is idiomatic but may not immediately convey its purpose to less experienced readers. The type hint and return statement are clear. Overall, the code is well-structured and maintains good action granularity, but could benefit from removing unused imports to improve clarity and reduce noise.
Run 1
Code Structure: The class and 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 follow. Clarity of intent: The descriptive class name, docstring, and explicit Proxy-Authorization header clearly convey the purpose; the parameter name r is less descriptive. Code length: The implementation is concise, but the import block is disproportionately long for the functionality shown. Action granularity: Each statement performs one clear action. Reading flow: The method naturally sets the authentication header and returns the request, although missing dependencies and irrelevant imports slightly interrupt comprehension.
Run 2
Code Structure: The class and its single method are logically organized, although the many 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, reducing self-contained clarity. Code length: The implementation is concise, but the import section is unnecessarily long for the functionality shown. Action granularity: Each line performs one clear action. Reading flow: The method flows naturally from setting the authentication header to returning the request, though unrelated imports distract from this straightforward logic.
Run 3
Code Structure: A clearly defined class contains a focused method, although numerous unused imports clutter the snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name, docstring, method annotations, and explicit Proxy-Authorization header clearly communicate its purpose; 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 block is disproportionately long. Action granularity: Each statement performs one clear action. Reading flow: The method naturally progresses from setting the authentication header to returning the request, though the irrelevant imports distract from this straightforward flow.