Sample

pyint-6ab07c8afe16-I13

Lower every eligible synchronous for loop to a while loop

Matched original source

Scores

MethodScoreScale
Posnett0.4050–1; higher is more readable
Dorn0.9180–1; higher is more readable
Mi0.4960–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol16.670–20; mean of three runs
BTTF0.8370–1; higher is more readable

Views

Source code

from __future__ import annotations from typing import TYPE_CHECKING, Any from urllib3.exceptions import HTTPError as BaseHTTPError from .compat import JSONDecodeError as CompatJSONDecodeError class HTTPError(RequestException): """An HTTP error occurred."""

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
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.853−7.279
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.144.754−4.777
Source linesThe number of non-empty source lines.7+2.8

Intercept 8.87 + feature contributions = -0.386 (log-odds).
Score = sigmoid(-0.386) = 0.405.

Feature contributions

FeatureValueContribution
(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.59.875+1.129
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.8+0.753
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.024+0.713
Indentation frequencyHow rapidly indentation changes from line to line.7−0.495
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.6.705−0.316
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.60+0.164

Intercept 0.07 + feature contributions = 2.416 (log-odds).
Score = sigmoid(2.416) = 0.918.

Score0.496
Score6
Run 1

The code is well-structured and highly readable. It uses a clear import block with forward compatibility and type-checking support. Class definition is concise with a docstring that clearly states intent. Nesting is virtually nonexistent, and each import/logical action is on its own line. One minor deduction for lack of context: the class is empty but inherits from `RequestException`, and `CompatJSONDecodeError` import is not used in the shown snippet, making purpose slightly ambiguous without surrounding code. Overall, very clean.

Run 2

The code is highly readable. It has a clear, logical structure: future import, typing imports, third-party import, local import, then a single class definition. There is no nesting and the intent is unambiguous—defining a custom HTTP error exception. The code is concise, with each import on its own line and a single class with a clear docstring. Action granularity is appropriate, and reading flow is natural from imports to class definition. Minor deductions for the aliased imports adding slight cognitive overhead and the class body being minimal (though this is appropriate for an exception).

Run 3

The code is highly readable due to its clean, logical structure and flat organization. It starts with clear imports, including future annotations and type-checking support, followed by a concise class definition with a clear docstring. The intent is unambiguous: define an HTTP error exception with a meaningful name and inheritance from RequestException. There is no unnecessary nesting or code bloat, and each action (imports, class definition, docstring) occupies its own logical unit. The reading flow is natural, moving from setup to definition. Minor deductions only because the code is incomplete for evaluation purposes (e.g., RequestException is not defined here), but within the given snippet, readability is excellent.

Run 1

Code Structure: Imports followed by a small exception class form a logical layout, though grouping imports and adding standard blank lines would improve organization. Nesting: No unnecessary nesting. Clarity of intent: The HTTPError name and docstring clearly indicate its purpose, but RequestException is not defined or imported in the snippet, and several imports appear unused. Code length: Very concise, with no unnecessary implementation. Action granularity: Each import and declaration occupies its own line. Reading flow: Straightforward from imports to class definition, with minor distractions from unused imports and the unresolved base class.

Run 2

Code Structure: Imports precede a small exception class, giving the snippet a logical organization, though several imports are unused and RequestException is not defined or imported here. Nesting: Minimal, with only a class body. Clarity of intent: The class name and docstring clearly identify an HTTP exception, but the missing base-class context and unused HTTP error alias introduce ambiguity. Code length: Very concise, although unused imports add clutter. Action granularity: Each import and declaration occupies its own line. Reading flow: Straightforward from imports to class definition; an additional blank line before the top-level class would improve conventional formatting.

Run 3

Code Structure: Imports precede a clearly separated exception class, giving the snippet a logical organization. Nesting: There is no unnecessary nesting. Clarity of intent: The class name and docstring clearly identify an HTTP exception, but RequestException is not defined or imported in the snippet, and the other imports have no visible use. Code length: The implementation is concise, though the unused imports add clutter. Action granularity: Each import and declaration occupies its own line. Reading flow: The top-to-bottom flow is straightforward, but grouping imports by origin and adding a second blank line before the top-level class would improve presentation.