Sample
pyint-d3a0a0b73377-I02
Shorten method, parameter, and local names without collisions
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 | 15 | 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 clean and readable but incomplete for full evaluation. It follows good practices: explicit imports from `__future__`, logical grouping of imports, and clear class naming. The `Timeout` class extends `RequestException` with a concise, well-written docstring. However, the snippet lacks implementation details (methods, logic, or error handling) that would allow deeper assessment of structure, nesting, or action granularity. The class body is empty aside from the docstring, making it hard to judge flow or complexity. Overall, it is well-organized and unambiguous, but the limited scope prevents a higher score since key readability factors like nesting depth, code length, and action granularity cannot be fully evaluated.
Run 3
The code is cleanly formatted and follows standard Python conventions, with clear imports and a well-documented class. The docstring is helpful and explains the intent. However, the snippet is very incomplete—only a class definition with no method bodies or usage context—which limits evaluation of action granularity and reading flow. The structure is logical but sparse; nesting is minimal. Clarity of intent is good due to the docstring, but overall length is extremely short, which makes it hard to assess balance or redundancy. The lack of surrounding logic or implementation details prevents a higher score.
Run 1
Code Structure: Imports followed by a single exception class provide straightforward organization, though several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name and docstring clearly describe a timeout exception and its catching behavior; however, RequestException is not defined or imported in the snippet. Code length: Concise, with no unnecessary implementation. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural progression from imports to declaration to documentation, with clear formatting.
Run 2
Code Structure: Imports precede a clearly separated exception class, although several imports appear unused and RequestException is not defined or imported in the snippet. Nesting: Minimal, with only the class body indented. Clarity of intent: The descriptive class name and docstring clearly explain the timeout exception and its relationship to connection and read timeouts. Code length: Very concise, though unused imports add clutter. Action granularity: Each import occupies its own line, and the class has a single documentation block. Reading flow: Natural top-to-bottom progression; however, the missing base-class context slightly interrupts understanding.
Run 3
Code Structure: Imports followed by a single exception class provide logical organization, though RequestException is not defined or imported in the snippet. Nesting: Minimal, with only a class-level docstring. Clarity of intent: The Timeout name and descriptive docstring clearly explain its purpose and related exceptions. Code length: Concise overall, but several imports appear unused in the provided snippet. Action granularity: Each import and declaration occupies its own line; no operations are bundled together. Reading flow: Straightforward top-to-bottom progression, although additional blank-line separation between import groups and before the class would improve visual organization.