Sample
pyint-a92946dff6b4-I02
Shorten method, parameter, and local names without collisions
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.106 | 0–1; higher is more readable |
| Dorn | 0.759 | 0–1; higher is more readable |
| Mi | 0.63 | 0–1; higher is more readable |
| LLOC | 20 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.756 | 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.75 | −7.125 |
Intercept 8.87 + feature contributions = -2.135 (log-odds).
Score = sigmoid(-2.135) = 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.034 | +0.61 |
| 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 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 33 | −0.336 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 67.386 | +0.283 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 42.857 | +0.189 |
Intercept 0.07 + feature contributions = 1.145 (log-odds).
Score = sigmoid(1.145) = 0.759.
| Score | 0.63 |
|---|
| Score | 20 |
|---|
Run 1
The code structure is logical, with clear separation of imports (future, stdlib, third-party/local) and a single well-documented class. Nesting is minimal and flat. Clarity of intent is high: the module and class docstrings clearly state the purpose, and the `__reduce__` method succinctly shows why the class exists. Code length is concise and proportional to the task—only one class is defined. Action granularity is appropriate; each logical step (e.g., returning a tuple) is on its own line. Reading flow is natural: imports group logically, the class definition follows immediately, and comments/docstrings guide the reader. Minor deductions are for the unusual default argument `none=type(None), arg=()` with a `noqa` comment, which may briefly puzzle readers, and for reliance on external context to fully appreciate the `cache_hash` behavior.
Run 2
The code is well-structured with clear imports, organized grouping, and appropriate use of future annotations. It demonstrates good separation of concerns: standard library imports followed by third-party/local imports, and exceptions imported distinctly. The module-level class _CacheHashWrapper has a clear purpose with a concise docstring explaining non-obvious behavior (pickling as None), which enhances clarity. Nesting is minimal and action granularity is appropriate—single logical operations per line. The code maintains a natural reading flow, moving from imports to class definition. However, the score is not higher because the unusual __reduce__ implementation, while documented, requires understanding of pickle internals and could benefit from a code comment or example. The default parameters mechanism (using __reduce__ signature with defaults) is clever but not immediately obvious. Overall, the code follows idiomatic Python practices and is accessible to developers familiar with object serialization concepts.
Run 3
The code is reasonably readable but has some issues. The imports are not alphabetically organized and mix multiple styles, making them harder to scan. The class has a clear docstring explaining its purpose, which improves clarity. The `__reduce__` method is concise and functional, but the default argument `none=type(None), arg=()` is a clever trick that may be unclear to readers without a comment. The naming is mostly clear, though `_lazy_is_generator` and `_AnnotationExtractor` are ambiguous without context. The code is mostly flat with minimal nesting, and actions are separated into logical lines. The overall structure is okay but could be improved by grouping and alphabetizing imports and avoiding overly clever default arguments. The class is short and focused, but the surrounding context from the larger module might affect readability.
Run 1
Code Structure: Imports are grouped logically, followed by a single focused class, although the many imports are unnecessary for this isolated snippet. 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 pickling; the default arguments in __reduce__ are less immediately intuitive. Code length: The implementation is concise, with documentation providing useful context rather than excessive detail. Action granularity: Each line performs one clear action. Reading flow: The progression from imports to class documentation to implementation is natural, though the lengthy import section delays reaching the small amount of relevant code.
Run 2
Code Structure: Imports precede a focused class with a single method, providing logical organization, though the many unused imports distract within this snippet. 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 __reduce__ defaults are less immediately intuitive. Code length: The implementation is concise, with proportionate explanatory documentation, but the import block dominates the excerpt. Action granularity: Each statement performs one action, and the return expression is straightforward. Reading flow: The progression from imports to class documentation to implementation is natural; additional spacing between import groups would improve scanning.
Run 3
Code Structure: Imports are grouped sensibly, followed by a single focused class. Nesting: Minimal, with only one method inside the class. Clarity of intent: The descriptive class name and detailed docstring clearly explain why cached hashes reset during copying or pickling; the specialized __reduce__ defaults are less immediately obvious. Code length: The implementation is concise, although many imports are unused in this excerpt. Action granularity: Each line performs one clear action. Reading flow: Natural progression from dependencies to explanation to implementation, with minor friction from the lengthy import section and the lack of an additional blank line before the top-level class.