Sample
pyint-4698b0e4f0b0-I11
Split eligible integer literals into pairs of short-named intermediate variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.824 | 0–1; higher is more readable |
| Dorn | 0.916 | 0–1; higher is more readable |
| Mi | 0.472 | 0–1; higher is more readable |
| LLOC | 6 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.67 | 0–20; mean of three runs |
| BTTF | 0.85 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (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
| 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. | 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.
| Score | 0.472 |
|---|
| Score | 6 |
|---|
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 a small fragment defining a custom exception class, so many criteria are only partially applicable. Structure is clear and the class definition is logically placed. Nesting is flat and there is no complexity. Intent is reasonably clear from the class name and docstring, though the docstring references ConnectTimeout and ReadTimeout without showing those definitions. Code length is concise—arguably too concise to fully evaluate. Action granularity is fine, with one logical action (defining the class) spanning a few lines. Reading flow is natural: imports, class definition, docstring. However, the code is incomplete for a full evaluation—missing the base class import (RequestException) and context—which lowers readability in a real-world sense. As a standalone snippet, it is understandable but not fully self-contained.
Run 3
The code is cleanly structured with a clear class definition, a docstring, and minimal imports. It is highly readable for its purpose: defining a simple exception class. The docstring explains the intent concisely, and there is no unnecessary nesting or tangled logic. However, the score is lowered because the code appears incomplete: 'RequestException' is referenced but not imported, 'Timeout' does not define any custom behavior or attributes, and the import of 'JSONDecodeError' and 'urllib3' exceptions seems unrelated to the class shown. This creates some ambiguity about the snippet's full context and intended use. Nevertheless, the visible code is well-formatted, follows Python conventions, and is easy to understand in isolation.
Run 1
Code Structure: Imports followed by a single exception class provide clear, logical organization. Nesting: Only the class body is indented, making the code easy to scan. Clarity of intent: The Timeout name and docstring clearly explain its purpose and which errors it catches, though RequestException is not defined or imported in the snippet. Code length: The class is concise; unused imports add minor clutter. Action granularity: Each import and declaration occupies its own line, with no compressed statements. Reading flow: The progression from imports to class declaration to documentation is natural, although an additional blank line before the class would improve visual separation.
Run 2
Code Structure: Imports precede a clearly defined exception class, providing logical organization, though RequestException is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The Timeout name and descriptive docstring clearly explain its purpose and related exceptions. Code length: Very concise, although the displayed imports are unused within this snippet and add some clutter. Action granularity: Each import and declaration occupies its own line, with no bundled actions. Reading flow: The progression from imports to class to documentation is natural; an additional blank line before the top-level class would improve conventional Python formatting.
Run 3
Code Structure: Imports followed by a focused exception class provide logical organization, though RequestException is not defined or imported in the snippet and the other imports appear unused. Nesting: Minimal, with only a class-level docstring. Clarity of intent: The class name and docstring clearly describe a request timeout and identify the related exceptions it catches. Code length: Short and appropriately concise, aside from potentially unnecessary imports. Action granularity: Each import occupies its own line, and the class has a single clear responsibility. Reading flow: Natural top-to-bottom progression, slightly weakened by the unresolved base class and limited spacing between imports and the class.