Sample
pyint-53b9f6091a29-I03
Replace names with length-matched meaningful but unrelated identifiers
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.106 | 0–1; higher is more readable |
| Dorn | 0.77 | 0–1; higher is more readable |
| Mi | 0.667 | 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 | 16.67 | 0–20; mean of three runs |
| BTTF | 0.729 | 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.748 | −7.122 |
Intercept 8.87 + feature contributions = -2.132 (log-odds).
Score = sigmoid(-2.132) = 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.617 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 44 | −0.522 |
| 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. | 75.977 | +0.447 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 33 | +0.404 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 70.818 | +0.338 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 33 | −0.336 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 42.883 | +0.19 |
Intercept 0.07 + feature contributions = 1.208 (log-odds).
Score = sigmoid(1.208) = 0.77.
| Score | 0.667 |
|---|
| Score | 20 |
|---|
Run 1
This code is highly readable. The structure is logical: imports are grouped clearly by standard library, third-party, and local modules, with explicit relative imports for internal dependencies. The single class defined is small, focused, and accompanied by a clear docstring that explains its purpose and rationale. Nesting is essentially flat—only one method exists and it is concise. Intent is very clear: the class wraps int to ensure hash values reset on copy/pickle, with rationale explicitly documented. Code length is appropriate; no unnecessary bloat or over-engineering. Action granularity is well-managed, with each import and the single method body containing distinct operations. Reading flow is natural—the reader progresses from imports to a single well-encapsulated class without jumping around. Minor deductions only because the method signature uses non-obvious parameter names and a noqa comment, which slightly interrupts flow, but this is justified for the pickle behavior.
Run 2
The code is well-structured and readable overall. It has a clear module-level organization with grouped imports and a focused class definition. Nesting is minimal, intent is clear from the class name and docstring, and the method is concise with one action per line. However, readability is slightly reduced by the unusual use of default arguments in __reduce__ (currentBalance=type(None), total=()) which is non-standard and could confuse readers, and the 'noqa: B008' comment adds minor clutter. Variable names like 'currentBalance' and 'total' are not descriptive for the intent of resetting hash values. The docstring is helpful but the logic of returning a tuple that effectively becomes None on pickling is not immediately obvious without deeper knowledge of Python's pickle protocol.
Run 3
The code is highly readable, well-structured, and demonstrates clear intent. It uses standard import organization, readable type hints, and a concise class definition. The single class `_CacheHashWrapper` is flat with only one method, avoiding excessive nesting. The method implements one clear action—returning a tuple for pickling. Naming is descriptive (e.g., `_CacheHashWrapper`, `__reduce__`). The use of `# noqa: B008` and comments shows attention to linting and rationale. Although the example is a partial module, the visible portion is logically organized, with only one small class to evaluate. The inclusion of `from __future__ import annotations` and careful imports suggests maintainability. Minor deductions for slightly dense import block and the unusual default argument `currentBalance=type(None)` with a noqa comment, but these don't significantly impair readability.
Run 1
Code Structure: Imports are grouped sensibly, followed by a focused class, although most imports are unused in this excerpt. 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. However, the parameter names currentBalance and total are misleading for serialization behavior, and the default type(None) requires familiarity with Python's reduction protocol. Code length: The implementation is concise; the longer docstring provides useful context rather than unnecessary repetition. Action granularity: Each statement performs a single action. Reading flow: The progression from imports to documentation to implementation is natural, though the extensive import block distracts from the small class and spacing between top-level sections could be improved.
Run 2
Code Structure: Imports precede a focused class, providing logical organization, although many imports are unused in this excerpt. 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 serialization or copying. However, the parameter names currentBalance and total are unrelated to their roles in __reduce__, creating unnecessary ambiguity. Code length: The implementation is concise; the docstring adds useful context rather than excessive detail. Action granularity: Each line performs a single clear action. Reading flow: The progression from imports to documentation to implementation is natural, though the large import block distracts from the small class, and additional spacing between import groups would improve readability.
Run 3
Code Structure: Imports are grouped logically, followed by a small, focused class, though many imports are unused in this excerpt. Nesting: Minimal, with only a class and its method. Clarity of intent: The docstring clearly explains why cached hashes reset during copying or pickling, but parameter names currentBalance and total are unrelated to serialization and obscure the method's behavior. Code length: The implementation is concise, with documentation providing useful context. Action granularity: Each line performs one clear action. Reading flow: Organization is natural, although the extensive import section delays the relevant code, and the misleading parameter names interrupt comprehension.