Sample
pyint-8cd6b583ed10-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.011 | 0–1; higher is more readable |
| Dorn | 0.772 | 0–1; higher is more readable |
| Mi | 0.602 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.746 | 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. | 638.793 | −21.08 |
| Source linesThe number of non-empty source lines. | 37 | +14.8 |
| 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.737 | −7.105 |
Intercept 8.87 + feature contributions = -4.515 (log-odds).
Score = sigmoid(-4.515) = 0.011.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.033 | +0.62 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 74.763 | +0.402 |
| 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 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 38 | −0.309 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 28 | +0.231 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 28 | −0.222 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 36.888 | +0.106 |
Intercept 0.07 + feature contributions = 1.217 (log-odds).
Score = sigmoid(1.217) = 0.772.
| Score | 0.602 |
|---|
| Score | 20 |
|---|
Run 1
The code demonstrates good readability: it has clear logical organization with imports grouped by type (stdlib, third-party, local). The class has a focused, single responsibility with good documentation explaining the 'why' behind its design. Nesting is minimal, and action granularity is generally one operation per line. However, some readability issues reduce the score: the import formatting is inconsistent in a few places (e.g., 'PY_3_11_PLUS, PY_3_13_PLUS,' and 'FrozenInstanceError, NotAnAttrsClassError,') with excessive spacing, and the exception import includes a trailing comma. The `__reduce__` method uses default arguments for performance optimization, which may seem unusual to readers without the explained context. The use of `# noqa: B008` is helpful for linters but could confuse developers unfamiliar with the convention. Overall, the code is professional, well-documented, and maintainable, but slight formatting inconsistencies prevent a higher score.
Run 2
The code demonstrates reasonable structure with clear imports, a well-defined class, and a descriptive docstring. However, there are several readability issues: the import statements are inconsistently formatted and overly lengthy, with multiple names crammed onto single lines; the __reduce__ method signature is cramped and includes an unconventional default argument pattern; and the overall organization, while functional, lacks the clean vertical spacing and consistent grouping that would make it more scannable. The class purpose is clear, and the docstring is helpful, but the action granularity is inconsistent—some lines contain multiple related items while others are properly separated. Nesting is minimal, which is positive. The reading flow is moderately good but could be improved with more systematic import organization and cleaner method signatures.
Run 3
The code is generally clear and well-structured. It uses imports, base classes, and docstrings effectively. The `_CacheHashWrapper` class has a clear purpose. However, the import formatting is awkward with inconsistent alignment and unnecessary vertical spacing, which slightly hurts readability. The multi-line imports could be consolidated. The `__reduce__` method has default arguments for optimization, which is a bit unusual but documented via comments. Overall, intent is clear and nesting is minimal, but the import section feels cluttered and the alignment choices are distracting rather than helpful.
Run 1
Code Structure: Imports precede a single, focused class, giving the snippet a logical organization, though grouped imports have inconsistent spacing. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The class name and detailed docstring clearly explain why cached hashes reset during copying or pickling; the special-method defaults are less immediately intuitive. Code length: The implementation is concise, with documentation providing useful context rather than unnecessary complexity. Action granularity: Each statement performs a single action, and the return expression is straightforward. Reading flow: The progression from imports to documentation to implementation is natural, but irregular import formatting and limited separation between sections slightly reduce readability.
Run 2
Code Structure: Imports precede a focused class, providing logical organization, though inconsistent import formatting adds clutter. Nesting: The class contains one short method with no nested control flow. Clarity of intent: The descriptive class name and docstring clearly explain why cached hashes reset during copying or pickling; the specialized __reduce__ defaults require some Python knowledge. Code length: The implementation is concise, with documentation proportionate to its non-obvious behavior. Action granularity: Statements perform one action each, although several imported names share awkwardly spaced lines. Reading flow: The progression from imports to documentation to implementation is natural, but irregular spacing and grouped imports slightly disrupt scanning.
Run 3
Code Structure: Imports and a single focused class are logically organized, though inconsistent import formatting reduces polish. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name and detailed docstring clearly explain why cached hashes reset during copying or pickling; the specialized __reduce__ signature requires some Python knowledge. Code length: The implementation is concise, and the explanatory docstring is justified by the non-obvious behavior. Action granularity: The method performs one clear return operation, although several imported names share awkwardly spaced lines. Reading flow: The progression from imports to class documentation to implementation is natural, but irregular spacing, crowded import lists, and limited separation between sections mildly disrupt readability.