Sample
pyint-1c5994b3720a-I05
Rewrite eligible decimal integer literals in hexadecimal notation
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.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 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 highly readable due to its clear structure and straightforward intent. It demonstrates good practices: explicit imports, type-checking support, and a well-defined exception hierarchy. The Timeout class is simple but well-documented, with a clear docstring explaining its purpose and relationship to other exceptions. Nesting is non-existent, and each action is on a separate line. The code is concise without sacrificing clarity.
Run 3
The code defines a custom exception class with a clear docstring, but it is incomplete and lacks necessary context. The class 'Timeout' inherits from 'RequestException', which is not imported or defined in the snippet, creating ambiguity. The imports hint at compatibility concerns (e.g., 'JSONDecodeError', 'HTTPError') but are unused, suggesting disorganization. The code structure is minimal, with no methods or logic, making it hard to evaluate action granularity or nesting. The docstring is informative, but the class body is empty, and the purpose of the class in the broader module is unclear. Missing imports for 'RequestException' and unused imports reduce readability and maintainability. Overall, the snippet is concise but incomplete, with a low score due to missing context and ambiguous structure.
Run 1
Code Structure: Imports precede a clearly defined exception class, though several imports appear unused in this snippet. Nesting: Minimal, with only the class body indented. Clarity of intent: The class name and docstring clearly communicate timeout behavior; however, RequestException is not defined or imported in the shown code. Code length: Short and appropriately concise. Action granularity: Each import and declaration occupies its own line, with no compressed statements. Reading flow: Natural top-to-bottom progression from dependencies to class documentation, although an additional blank line before the top-level class would improve conventional formatting.
Run 2
Code Structure: Imports followed by a single exception class provide 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 docstring clearly explain its purpose and the related exceptions it covers. Code length: Concise overall, but several imports appear unused within the provided snippet. Action granularity: Each import and declaration occupies a separate line, avoiding compressed operations. Reading flow: Natural top-to-bottom flow, although an additional blank line before the top-level class would improve conventional formatting.
Run 3
Code Structure: Imports followed by a single exception class provide a logical organization, though RequestException is not defined or imported in the snippet. Nesting: No unnecessary nesting. Clarity of intent: The class name and docstring clearly describe the timeout exception and its related subclasses. Code length: Concise, although several imports appear unused in this excerpt. Action granularity: Each import and declaration occupies its own line. Reading flow: Straightforward top-to-bottom flow; an additional blank line before the top-level class would improve conventional formatting.