Sample
pyint-0df73684105d-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.65 | 0–1; higher is more readable |
| Dorn | 0.86 | 0–1; higher is more readable |
| Mi | 0.307 | 0–1; higher is more readable |
| LLOC | 6 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 18 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17.33 | 0–20; mean of three runs |
| BTTF | 0.789 | 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.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
| Feature | Value | Contribution (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.
| Score | 0.307 |
|---|
| Score | 6 |
|---|
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 is highly readable. It uses clear imports with appropriate aliases and `__future__` annotations for consistency. The class definition is concise, with a descriptive name and a docstring that clearly explains the error's meaning and implications (safe to retry). The inheritance is straightforward, and the structure is flat with no nesting or ambiguity. It is concise and each line serves a single, clear purpose. The only minor deduction is that the unused `TYPE_CHECKING` and `Any` imports could be removed or used, but this does not significantly impact readability.
Run 3
The code is highly readable. It follows a clear structure: imports, then class definition with a docstring clarifying intent and usage. Nesting is flat, with only top-level constructs. The class name and docstring make the purpose unambiguous, especially the note about safe retries. Code length is concise and avoids unnecessary verbosity. While the class body is minimal (just a docstring), this is appropriate for an exception type. Import aliasing and conditional imports suggest a compatibility layer but do not detract from clarity. Reading flow is natural: standard imports, then compat import, then class. Minor deductions: no explicit 'pass' statement (acceptable but some may expect it), and no additional methods or attributes shown, though not needed.
Run 1
Code Structure: Imports precede a focused exception class, providing clear organization, though several imports are unused in this snippet. Nesting: Only a class and its docstring are present, with no complex nesting. Clarity of intent: The class name and docstring clearly describe a connection timeout and retry safety; the undefined base classes require external context. Code length: Very concise, with no unnecessary implementation. Action granularity: Each import and declaration occupies its own line. Reading flow: Natural top-to-bottom progression, although an additional blank line before the top-level class would improve visual separation.
Run 2
Code Structure: Imports followed by an exception class provide logical organization, though ConnectionError and Timeout are not defined or explicitly imported in the snippet. Nesting: The code is flat, with only a class body. Clarity of intent: The class name and docstring clearly explain the connection timeout and retry behavior; unused imports distract from that purpose. Code length: The implementation is concise, but several imports appear unnecessary in isolation. Action granularity: Each import and declaration occupies its own line, with no compressed actions. Reading flow: The progression from imports to class declaration and documentation is natural, although an additional blank line before the top-level class would improve conventional formatting.
Run 3
Code Structure: Imports precede a clearly defined exception class, providing logical 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 explain the connection timeout and retry safety; however, ConnectionError and Timeout are not defined or imported here, leaving inheritance partly unclear. Code length: Concise, with no unnecessary implementation, although unused imports add clutter. Action granularity: Each import and class declaration occupies its own line, with no bundled actions. Reading flow: Natural progression from imports to declaration to documentation; an additional blank line before the top-level class would improve conventional formatting.