Sample
pyint-f26f9dd9cd5c-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.27 | 0–1; higher is more readable |
| Mi | 0.561 | 0–1; higher is more readable |
| LLOC | 64 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.382 | 0–1; higher is more readable |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 4649.443 | −153.432 |
| Source linesThe number of non-empty source lines. | 166 | +66.4 |
| 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.613 | −6.919 |
Intercept 8.87 + feature contributions = -85.081 (log-odds).
Score = sigmoid(-85.081) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 167 | −4.877 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 139 | +4.071 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 139 | −2.769 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 165.932 | +1.91 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 101.934 | +0.84 |
| 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. | 101.97 | −0.654 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.054 | +0.415 |
Intercept 0.07 + feature contributions = -0.994 (log-odds).
Score = sigmoid(-0.994) = 0.27.
| Score | 0.561 |
|---|
| Score | 64 |
|---|
Run 1
The code is well-structured with clear separation of imports, class definition, type annotations, and methods. Nesting is minimal, and the intent of the Request class is documented with a helpful docstring and usage example. Type hints improve clarity, and method signatures are explicit. However, the prepare method contains a useless loop that computes even_number_count but never uses it, which is ambiguous and hurts readability. Imports are extensive but organized logically. The code is concise overall, though the dead code in prepare() is unnecessarily confusing and should be removed. Action granularity is good, but the unexplained loop breaks reading flow.
Run 2
The code is highly readable overall. It has a clear structure with organized imports, type annotations, and a well-documented Request class. The __init__ method is flat and sequential, with each instance variable assignment on its own line, showing good action granularity. The docstring clearly explains the intent and usage. However, there is one notable issue: the prepare() method contains a pointless loop that computes even_number_count, which is never used. This confusing dead code hurts clarity of intent and reading flow. Additionally, the method signature is quite long, but this is mitigated by clean formatting. The code is concise despite many imports and generally follows the criteria well.
Run 3
The code is generally readable with clear structure and intent, but has some issues. Imports are logical but lengthy. The Request class has clear documentation and type hints, making its purpose evident. The __init__ method is straightforward with sensible default handling. The prepare() method contains an unexplained, irrelevant loop counting even numbers that doesn't contribute to the function's stated purpose, which obscures intent and adds unnecessary length. Variable naming is mostly clear. The class attributes and constructor parameters are well-typed, aiding readability. Action granularity is good - one logical operation per line. The reading flow is natural, moving from initialization to preparation. However, the presence of dead code (the counting loop) and the extensive import block reduce the score. The code would benefit from removing the unrelated loop and possibly grouping related imports more tightly. Overall, it's readable Python code with minor clarity issues, reflected in the moderate score.
Run 1
Code Structure: The class is logically organized into documentation, typed attributes, initialization, representation, and preparation, though the large import block and externally defined dependencies add overhead. Nesting: Most code is flat; the unnecessary counting loop introduces modest nesting. Clarity of intent: Descriptive names, type annotations, and detailed docstrings clearly explain request construction, but the unused even_number_count calculation has no apparent connection to preparation. Code length: Initialization and argument forwarding are straightforward, although imports, extensive documentation, and the irrelevant loop make this excerpt longer than necessary. Action granularity: Statements generally perform one action per line, and multiline signatures and calls are easy to scan. Reading flow: The progression from configuration to preparation is natural, but the unrelated counting logic interrupts it; the abbreviated variable p is also less informative than prepared_request.
Run 2
Code Structure: The class is logically organized into attributes, initialization, representation, and preparation, although many imports are unrelated to this excerpt. Nesting: Control flow is mostly flat, with only a shallow loop and conditional in prepare(). Clarity of intent: Descriptive names, type annotations, and comprehensive documentation clearly explain request construction. However, the unused even_number_count calculation is unrelated to preparing a request and distracts from its purpose; several referenced types and base classes are not defined in the excerpt. Code length: Most implementation is concise, but extensive imports and the redundant counting loop add clutter. Action granularity: Statements generally perform one action per line, and keyword arguments are neatly separated. Reading flow: Initialization followed by representation and preparation creates a natural progression, interrupted primarily by the irrelevant loop.
Run 3
Code Structure: The class is logically organized into documentation, attributes, initialization, representation, and preparation, though the extensive imports distract from the small implementation. Nesting: Mostly flat, with only shallow loops and conditionals. Clarity of intent: Descriptive names, type annotations, and detailed documentation clearly explain request construction; however, the unused even-number counting loop in prepare() is unrelated and confusing. Code length: Initialization and delegation are reasonably concise, but the irrelevant loop and large import section add unnecessary length to this excerpt. Action granularity: Statements generally perform one action per line, and multiline arguments are easy to scan. Reading flow: The progression from initialization to preparation is natural, but the counting loop interrupts it. Referenced classes and types not defined or imported in the excerpt also require external context.