Sample
pyint-36c89db0093e-I06
Invert eligible conditions and exchange their branches
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.106 | 0–1; higher is more readable |
| Dorn | 0.761 | 0–1; higher is more readable |
| Mi | 0.707 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.752 | 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. | 43 | +17.2 |
| 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.746 | −7.119 |
Intercept 8.87 + feature contributions = -2.129 (log-odds).
Score = sigmoid(-2.129) = 0.106.
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.619 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 44 | −0.522 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 75.364 | +0.412 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 33 | +0.404 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 33 | −0.336 |
| 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. | 78.977 | +0.32 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 42.913 | +0.19 |
Intercept 0.07 + feature contributions = 1.157 (log-odds).
Score = sigmoid(1.157) = 0.761.
| Score | 0.707 |
|---|
| Score | 20 |
|---|
Run 1
The code is generally well-structured and readable. It demonstrates clear organization with logical import grouping (stdlib, third-party, local), explicit future annotations import, and a focused single-class definition. The class has a clear docstring explaining its purpose and non-obvious behavior, which significantly improves clarity. Nesting is flat with no conditional logic. Action granularity is appropriate - each line performs one clear operation. The reading flow is natural: imports, then class definition, then method. The use of type hints (int subclass, annotations) adds to clarity. Minor deductions: the import section is somewhat long but follows Python conventions. The default argument pattern (_none_constructor=type(None), _args=()) is slightly unconventional and may require readers to pause. The blanket noqa comment suppresses linting checks without specifying which rule is being disabled. Overall, this is readable code appropriate for a library implementation.
Run 2
The code is highly readable with clear structure and purpose. It uses standard library imports organized logically, with explicit comments explaining the custom integer subclass. The class `_CacheHashWrapper` is short, focused, and documented, with a clear explanation of its purpose, behavior, and reference to relevant issue. Naming is descriptive, type hints are used consistently, and the docstring provides context that reduces ambiguity. Nesting is minimal, and each logical component is separated with blank lines. The 'noqa: B008' comment demonstrates intentional design. If any minor deductions apply, they relate to slight verbosity in import grouping or comments, but this does not materially reduce readability. Code length is appropriate for the complexity, and action granularity is one action per line for key methods. Overall, it follows best practices and reads naturally.
Run 3
The code is highly readable due to its clean, logical imports and well-structured class definition. Imports are grouped and sorted, with explicit `from __future__ import annotations` for modern typing. The class `_CacheHashWrapper` has a clear purpose, documented by a concise docstring explaining its role and rationale. Nesting is minimal, with only one method defined at a flat level. The method `__reduce__` is short and self-explanatory, with default arguments used intentionally and marked with a noqa comment. The use of type hints, named imports, and constants improves clarity. Action granularity is appropriate—each logical step is separated clearly. The reading flow is natural, moving from imports to a single focused class. Minor deductions: the `# noqa: B008` comment could benefit from a brief explanation, and some readers might find the default argument pattern slightly unusual without context.
Run 1
Code Structure: Imports are grouped logically, followed by a small, focused class. Nesting: Minimal nesting makes the implementation easy to follow. Clarity of intent: The descriptive class name and detailed docstring clearly explain why cached hashes reset during copying or serialization; the specialized __reduce__ defaults require some Python knowledge. Code length: The implementation is concise, although the extensive imports appear disproportionate to this excerpt. Action granularity: Each statement performs one clear action. Reading flow: The progression from imports to documentation to implementation is natural, with minor friction from the dense import section and limited spacing between top-level elements.
Run 2
Code Structure: Imports and a single focused class are logically organized, though many imports are unused in this excerpt. Nesting: Minimal; only one method sits inside the class. Clarity of intent: The descriptive class name and detailed docstring explain why cached hashes reset during copying or pickling. The default arguments in __reduce__ are less immediately intuitive, and the noqa annotation adds minor cognitive overhead. Code length: The implementation is concise; documentation is longer but provides useful rationale. Action granularity: Each import or statement occupies its own line, with no compressed multi-action statements. Reading flow: The progression from imports to documentation to implementation is natural, although the large import block delays reaching the small amount of relevant logic.
Run 3
Code Structure: Imports are grouped logically, followed by a focused class definition. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The descriptive class name and detailed docstring clearly explain why cached hashes reset during copying or pickling, though the special-method defaults require some Python knowledge. Code length: The implementation is concise; the extensive imports appear unnecessary for this isolated snippet. Action granularity: Each statement performs a single action, and the return is straightforward. Reading flow: The progression from imports to documentation to implementation is natural, although additional blank lines between import groups and before the class would improve visual separation.