Sample
pyint-ce33b361f99e-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.01 | 0–1; higher is more readable |
| Dorn | 0.873 | 0–1; higher is more readable |
| Mi | 0.497 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.688 | 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. | 422.873 | −13.955 |
| Source linesThe number of non-empty source lines. | 19 | +7.6 |
| 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.708 | −7.062 |
Intercept 8.87 + feature contributions = -4.547 (log-odds).
Score = sigmoid(-4.547) = 0.01.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 64.7 | +0.925 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.035 | +0.6 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 20 | +0.328 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 65 | +0.244 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 18.894 | −0.146 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 19 | −0.08 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 19 | −0.015 |
Intercept 0.07 + feature contributions = 1.927 (log-odds).
Score = sigmoid(1.927) = 0.873.
| Score | 0.497 |
|---|
| Score | 17 |
|---|
Run 1
The code is highly readable. It begins with clear future import and standard imports, organized logically (standard library, then local modules). Constants like `Final` are properly imported. The `AuthBase` class has a clear docstring and a single, focused method with a descriptive parameter type hint and return type. Nesting is non-existent, action granularity is one action per line, and overall structure is flat. The only minor deduction is that some imported names (e.g., `overload`, `cast`, `Any`) are not used in the shown code, which slightly reduces clarity of intent for a reviewer seeing only this fragment.
Run 2
The code is highly readable. It has a clear, flat structure with no nesting. Imports are organized logically, and the single class with a concise docstring and one method is straightforward. The use of type hints and the NotImplementedError with a clear message demonstrates clarity of intent. Each action is on its own line, and the reading flow is natural.
Run 3
The code is highly readable with a clear, logical structure. It begins with standard library imports, followed by typing imports, then internal/local imports — a conventional and organized pattern. Nesting is minimal; there are no deeply nested control structures. The intent is explicit: defining an abstract base class for authentication with a clear docstring and a straightforward `__call__` method that raises `NotImplementedError`. The code is concise, avoiding unnecessary verbosity. Action granularity is appropriate — each import and class/method definition occupies its own line, enhancing clarity. Reading flow is natural, moving from dependencies to class definition to method body. Minor deductions: the import block is slightly long and some type-related imports (e.g., `Final`, `cast`, `overload`) are unused in the visible code, which could confuse readers about their purpose.
Run 1
Code Structure: Imports followed by a clearly defined authentication base class provide logical organization, though many imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, type annotations, and explicit NotImplementedError clearly communicate the callable authentication interface; the parameter name 'r' is less descriptive, and PreparedRequest is not defined or imported in the snippet. Code length: The implementation is concise, but the extensive import list adds unnecessary bulk here. Action granularity: Each statement occupies its own line. Reading flow: The progression from imports to class to method is natural, though additional spacing between import groups and before the class would improve readability.
Run 2
Code Structure: Imports precede a clearly defined base class, providing logical organization, though numerous unused imports clutter this standalone snippet. Nesting: Minimal, with only a class and its method. Clarity of intent: The class name, docstring, and NotImplementedError clearly establish an authentication interface; however, the parameter name 'r' is vague, and PreparedRequest is not defined or imported in the shown code. Code length: The implementation is concise, but the import block is disproportionate to its functionality. Action granularity: Each statement occupies its own line. Reading flow: Natural top-to-bottom progression, slightly weakened by limited spacing between import groups and the class.
Run 3
Code Structure: Imports followed by a small base class provide logical organization, although many imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name, docstring, typed call signature, and explicit NotImplementedError clearly communicate the authentication-hook interface; PreparedRequest is not defined or imported in the shown code. Code length: The implementation is concise, but the extensive import list adds visual overhead. Action granularity: Each line performs a single clear action. Reading flow: The progression from dependencies to interface is natural, though blank lines separating import groups and preceding the class would improve readability.