Sample
pyint-85feaa2e947f-I08
Select one of ten high-readability unrelated code templates per class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.025 | 0–1; higher is more readable |
| Dorn | 0.753 | 0–1; higher is more readable |
| Mi | 0.704 | 0–1; higher is more readable |
| LLOC | 23 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 11.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.49 | 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. | 723.55 | −23.877 |
| Source linesThe number of non-empty source lines. | 46 | +18.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.712 | −7.068 |
Intercept 8.87 + feature contributions = -3.675 (log-odds).
Score = sigmoid(-3.675) = 0.025.
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. | 47 | −0.628 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.035 | +0.604 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 36 | +0.508 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 75.574 | +0.415 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 36 | −0.405 |
| 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. | 79 | +0.319 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 45.913 | +0.232 |
Intercept 0.07 + feature contributions = 1.115 (log-odds).
Score = sigmoid(1.115) = 0.753.
| Score | 0.704 |
|---|
| Score | 23 |
|---|
Run 1
The code fails to deliver on readability despite proper imports and docstring conventions. The while-loop in __reduce__ is a nonsensical no-op that adds three lines of dead code, obscuring the function's purpose and violating the 'one action per line' principle. The method's actual intent—returning a None-constructor tuple—is buried after this pointless iteration. The class-level logic is straightforward, but the method body is tangled and misleading. The code lacks consistent spacing and includes unnecessary complexity in a simple serialization hook. The linecache and sys imports suggest larger, unshown code, but the visible segment is poorly structured and unclear in intent.
Run 2
The code is well-structured with clear imports, a documented class, and reasonable use of annotations and constants. The class name and docstring clearly explain intent. Nesting is minimal and reading flow is natural. The main issue is the `__reduce__` method: its redundant loop with `remaining_steps` and cryptic default arguments hurts clarity and action granularity, appearing unnecessarily verbose without purpose. Overall, the code is readable but slightly marred by that confusing method.
Run 3
The code shows moderate readability with clear structure and intent in most areas. The imports are well-organized, and docstrings clarify purpose. The class definition and method signature are clean. However, the score is reduced by the meaningless while loop inside __reduce__, which adds unnecessary complexity and obscures the method's actual purpose. The nested loop, despite being flat, has no clear reason to exist and breaks the reading flow. Variable naming is clear, but the factory call arguments use noqa comments and underscore-prefixed defaults that are reasonable. Overall, the code demonstrates good organization but loses points for confusing dead code and some minor ambiguity in its execution flow.
Run 1
Code Structure: Imports and the single class are logically organized, although most imports are unused in this snippet. Nesting: The method has only one shallow loop, making control flow easy to follow. Clarity of intent: The class name and detailed docstring clearly explain why cached hashes should reset during copying or pickling. However, the countdown loop has no apparent purpose and distracts from that intent. Code length: The implementation is short, but the redundant loop and extensive imports add unnecessary length. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: The progression from imports to documentation to implementation is natural, but the unexplained loop interrupts an otherwise straightforward return.
Run 2
Code Structure: Imports and a small, documented class provide clear organization, although most imports are unused in this snippet. Nesting: Only a single shallow loop appears, so nesting is easy to follow. Clarity of intent: The class docstring clearly explains why cached hashes should reset during copying or pickling, but the unexplained countdown loop obscures the otherwise simple method. Code length: The method is short, yet the redundant loop and extensive imports add unnecessary bulk relative to its functionality. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: Conventional formatting and descriptive parameter names support readability, but the irrelevant loop interrupts the natural progression from the documented purpose to the return value.
Run 3
Code Structure: Imports, class, documentation, and method are logically organized, although the many imports appear unused in this snippet. Nesting: Shallow nesting makes the method easy to follow. Clarity of intent: The class docstring clearly explains why copied or pickled hash values should reset to None, but the countdown loop has no apparent purpose and distracts from that intent. Code length: The implementation is short, yet the redundant loop and extensive imports add unnecessary length. Action granularity: Each statement performs one action, with no compressed or compound lines. Reading flow: The progression from explanation to implementation is natural, but the pointless loop interrupts the otherwise direct return behavior.