Sample

pyint-29909a12ba00-I13

Lower every eligible synchronous for loop to a while loop

Matched original source

Lines12

Scores

MethodScoreScale
Posnett0.8240–1; higher is more readable
Dorn0.9160–1; higher is more readable
Mi0.4720–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.850–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 Timeout(RequestException): """The request timed out. Catching this error will catch both :exc:`~requests.exceptions.ConnectTimeout` and :exc:`~requests.exceptions.ReadTimeout` errors. """

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.855−7.282
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.146.719−4.842
Source linesThe number of non-empty source lines.12+4.8

Intercept 8.87 + feature contributions = 1.546 (log-odds).
Score = sigmoid(1.546) = 0.824.

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.60+1.124
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.015+0.797
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.13+0.576
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.11.639−0.247
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.59.923+0.162

Intercept 0.07 + feature contributions = 2.385 (log-odds).
Score = sigmoid(2.385) = 0.916.

Score0.472
Score6
Run 1

The code is highly readable with a clear, logical structure. It imports only necessary components, groups them logically (standard typing, third-party, local), and defines a single, well-named exception class. Nesting is non-existent, and the class purpose is explicit through a descriptive name and a succinct docstring that explains what the error represents and how to catch it. Code length is minimal and appropriate, with one action per line where applicable. Reading flow is natural: imports, then class definition, then documentation. Minor points deducted only because the class body is entirely documentation with no custom logic, which might initially confuse some readers about its necessity, though this is common for exception classes. Overall, it adheres well to clean-code principles.

Run 2

The code is highly readable. It demonstrates a clear, logical structure with straightforward imports and a simple class definition. Nesting is minimal—just one class with a docstring. The intent is explicit: define a Timeout exception that encompasses both ConnectTimeout and ReadTimeout. The code is concise, avoiding unnecessary length. Action granularity is appropriate, with each import on its own line and the class definition clearly separated. The reading flow is natural: imports, then class definition, then documentation. The docstring is informative, though it doesn't explain why the class is empty, which is a very minor clarity issue. Overall, the code is clear, well-organized, and easy to understand.

Run 3

The code is highly readable with clear structure and intent. It defines a custom exception class with a docstring explaining its purpose and relationship to other exceptions. The imports are organized and use future annotations for forward compatibility. The code is concise with no unnecessary complexity. However, there is a minor issue: the base class RequestException is not imported, which could cause a NameError at runtime. Additionally, the docstring references exceptions that are not visible in this snippet, but this is acceptable for isolated code. The naming is clear, and the exception hierarchy intent is obvious. Overall, the code demonstrates good readability despite the missing import.

Run 1

Code Structure: Imports followed by a single exception class provide straightforward organization. Nesting: Minimal nesting makes the snippet easy to scan. Clarity of intent: The class name and docstring clearly describe a timeout exception and its catch behavior, though RequestException is not defined or imported in the snippet. Code length: Compact, with no unnecessary implementation, although several imports are unused here. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural top-to-bottom progression, slightly weakened by unrelated imports and the missing base-class context.

Run 2

Code Structure: Imports followed by a focused exception class provide logical organization, though RequestException is not defined or imported in the snippet. Nesting: Flat, with only the class body. Clarity of intent: The Timeout name and docstring clearly explain its purpose and which related errors it covers. Code length: Concise, although several imports appear unused in this excerpt. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural and easy to follow; an additional blank line before the top-level class would improve formatting.

Run 3

Code Structure: Imports followed by a single exception class provide straightforward organization, though RequestException is not defined or imported in the snippet. Nesting: Only the class body is indented, making navigation effortless. Clarity of intent: The descriptive class name and docstring clearly explain the timeout and which related exceptions catching it covers. Code length: Very concise, although several imports appear unused within this snippet. Action granularity: Each import and declaration occupies its own line, with no combined actions. Reading flow: Natural top-to-bottom progression; an additional blank line before the top-level class would improve conventional formatting.