Sample
pyint-fd94ee8f8f2a-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.795 | 0–1; higher is more readable |
| Mi | 0.401 | 0–1; higher is more readable |
| LLOC | 33 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 9.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 12 | 0–20; mean of three runs |
| BTTF | 0.542 | 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. | 1596.975 | −52.7 |
| Source linesThe number of non-empty source lines. | 70 | +28 |
| 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.411 | −6.617 |
Intercept 8.87 + feature contributions = -22.447 (log-odds).
Score = sigmoid(-22.447) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 71 | −1.478 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 43 | +0.75 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 69.86 | +0.567 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 83.831 | +0.548 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.052 | +0.436 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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. | 84.972 | +0.066 |
Intercept 0.07 + feature contributions = 1.358 (log-odds).
Score = sigmoid(1.358) = 0.795.
| Score | 0.401 |
|---|
| Score | 33 |
|---|
Run 1
The code has decent structure and a clear class-level docstring, but readability is severely undermined by the __init_subclass__ implementation. It uses bizarre __import__('builtins') constructs, manual iteration loops with try/except StopIteration, and while True loops instead of simple for loops. This creates deep, awkward nesting that obscures the obvious intent—collecting method names from parent classes and HTTP method functions. The repeating loop pattern is verbose and confusing, making the logic hard to follow. However, dispatch_request is relatively clean and readable with good comments. Naming conventions like 'loopIterator' and 'loopIteratorA' are vague and unhelpful. The methods collection logic could be 5-6 lines using comprehensions or simple for loops, dramatically reducing length and improving clarity. The overall structure is logical, but the execution creates unnecessary complexity that buries the straightforward purpose.
Run 2
The code has good structure with a clear class hierarchy and docstring, but readability is hampered by the __init_subclass__ method. It uses manual while-loop iteration with builtins.next/StopIteration instead of natural for loops, obscuring intent. Naming is ambiguous ('loopIterator', 'loopIteratorA') and the logic for collecting HTTP methods is harder to follow than necessary. Nesting is moderate but avoidable try/except blocks add noise. The dispatch_request method is clearer, with a concise flow and helpful comments. Overall, the code is not unreadable, but the unusual iteration pattern and lack of clear variable naming reduce clarity and reading flow significantly compared to idiomatic Python.
Run 3
The code has a clear purpose and the docstring is helpful, but the implementation obscures that clarity. The __init_subclass__ method uses manual iterator loops with dynamic imports of builtins to iterate over bases and http_method_funcs, which is unnecessarily convoluted and should simply use 'for base in cls.__bases__' and 'for key in http_method_funcs'. This creates confusing nesting and poor reading flow. The action granularity is mixed; while some lines do one thing, the manual try/except loops spread a single logical action across multiple lines. The dispatch_request method is more readable, but the overall unnatural iterator pattern severely damages the score despite the class's well-documented intent.
Run 1
Code Structure: The class cleanly separates method discovery from request dispatch, but manual iterator management tangles discovery logic. Nesting: Moderate nesting, with try/except blocks inside loops inside a conditional, adds avoidable complexity. Clarity of intent: The docstring, type annotations, and HEAD fallback comment explain the purpose well; generic iterator names and repeated dynamic builtins imports obscure otherwise simple operations. Code length: Both while loops are unnecessarily verbose substitutes for straightforward for loops, although dispatch_request is concise. Action granularity: Most lines perform one action, but dynamic imports embedded in iterator operations make individual statements harder to parse. Reading flow: The overall progression is logical, but repeated StopIteration handling interrupts the flow and distracts from collecting supported methods.
Run 2
Code Structure: The class separates method discovery from request dispatch logically, but manual iterator machinery clutters initialization. Nesting: Initialization contains moderately deep nesting through conditionals, loops, and try/except blocks; dispatch remains flat. Clarity of intent: The docstring, HEAD fallback comment, and descriptive method names explain the purpose well, while generic iterator names and repeated dynamic builtins imports obscure simple iteration. Code length: Two ordinary for loops would substantially shorten the unnecessarily verbose initialization. Action granularity: Most lines perform one action, although dynamic imports embedded in iterator operations add cognitive overhead. Reading flow: Dispatch reads naturally, but repeated while/try/except patterns interrupt method discovery. References to View and http_method_funcs are not defined in the provided snippet, reducing its standalone clarity.
Run 3
Code Structure: The class logically separates method discovery from request dispatch, but discovery is cluttered by manual iterator handling. Nesting: Moderate nesting in __init_subclass__, including while/try/except blocks inside a conditional, makes scanning harder. Clarity of intent: The docstring, type annotations, and HEAD fallback comment explain the purpose well; generic iterator names and repeated dynamic builtins imports obscure otherwise simple loops. Code length: Two verbose iterator loops could be replaced with concise for loops; the long docstring is useful documentation rather than unnecessary code. Action granularity: Most lines perform one clear action, although chained dynamic imports and calls add visual complexity. Reading flow: dispatch_request reads naturally, while exception-driven iteration interrupts the discovery logic. View and http_method_funcs are not defined or imported in the shown snippet, reducing standalone clarity.