Sample

pyint-c0f6cf2dbd69-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines10

Scores

MethodScoreScale
Posnett0.650–1; higher is more readable
Dorn0.860–1; higher is more readable
Mi0.3070–1; higher is more readable
LLOC6Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol17.330–20; mean of three runs
BTTF0.7890–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 ConnectTimeout(ConnectionError, Timeout): """The request timed out while trying to connect to the remote server. Requests that produced this error are safe to retry. """

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.692−7.039
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.157.891−5.21
Source linesThe number of non-empty source lines.10+4

Intercept 8.87 + feature contributions = 0.621 (log-odds).
Score = sigmoid(0.621) = 0.65.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.019+0.761
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.11+0.647
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.74+0.531
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.9.88−0.272
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.60.636+0.174

Intercept 0.07 + feature contributions = 1.813 (log-odds).
Score = sigmoid(1.813) = 0.86.

Score0.307
Score6
Run 1

The code is highly readable and well-structured. It uses clear imports with future annotations for modern type hinting. The exception class `ConnectTimeout` inherits logically from `ConnectionError` and `Timeout`, accurately reflecting its purpose. The docstring concisely explains when the error occurs and explicitly notes that retrying is safe, which is crucial for error handling. Nesting is nonexistent, and each import is on its own line, following clean action granularity. The code length is minimal and avoids unnecessary complexity. Reading flow is natural: imports first, then class definition with documentation. Minor deductions only because the docstring could include a period after the first sentence, and the class body contains only a docstring, which is acceptable for an exception class.

Run 2

The code demonstrates excellent structure with clear separation of imports, clean class definition, and a concise, informative docstring. Nesting is minimal (flat), and the intent is immediately clear: defining a specific timeout exception class. The code is concise without being ambiguous. Action granularity is appropriate—each line serves one logical purpose. Reading flow is natural, with imports at the top, class declaration in the middle, and documentation below. Minor deductions: the double inheritance (ConnectionError, Timeout) could benefit from a brief comment explaining why both are needed, and the class body is simple enough that the docstring's second line might be redundant for experienced readers. The use of future annotations and type checking imports is idiomatic but slightly verbose for such a small class. Overall, the code is highly readable and follows Python best practices.

Run 3

The code is concise and clear, with logical structure and low nesting. It imports only what is needed and defines a single exception class with a precise docstring that explains intent and retry safety. Naming is explicit and action granularity is one concept per line. Reading flow is natural. It loses a couple points only because context is incomplete for full evaluation (e.g., unused imports like TYPE_CHECKING, Any, BaseHTTPError, CompatJSONDecodeError may be intentional but are not utilized in this snippet), and docstring could also mention timeout context. Still, readability is very high.

Run 1

Code Structure: Imports precede a clearly defined exception class, providing logical organization, though an additional blank line before the class would improve separation. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name and docstring clearly communicate a connection timeout and retry safety; the parent classes are not defined or imported in the snippet. Code length: The implementation is concise, although several imports are unused in the shown code. Action granularity: Each import and declaration occupies its own line. Reading flow: The progression from imports to class declaration to documentation is natural and straightforward.

Run 2

Code Structure: Simple organization with imports followed by a single exception class, though several imports are unused in this snippet. Nesting: Flat, with no nested control flow. Clarity of intent: The class name and docstring clearly describe a connection timeout and retry safety; however, ConnectionError and Timeout are not explicitly imported or defined, leaving inheritance context unclear. Code length: Concise, with no unnecessary implementation. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural top-to-bottom progression, although clearer spacing between import groups and before the class would improve readability.

Run 3

Code Structure: Imports followed by a focused exception class provide logical organization, although several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive class name and docstring clearly explain the connection timeout and retry safety, but ConnectionError and Timeout are not defined or imported here, leaving inheritance context unclear. Code length: Concise, with no unnecessary implementation, though unused imports add clutter. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural top-to-bottom flow; an additional blank line before the top-level class would improve conventional formatting.