Sample
pyint-cab027c123cf-I12
Inline all eligible single-use intermediate local variables
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 | 15.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 demonstrates clear structure with a logical import organization, separating standard library, third-party, and local imports. It uses modern Python features (from __future__ import annotations, abc, enum imports) appropriately. The single class _CacheHashWrapper has a clear docstring explaining its purpose and includes a reference to the relevant issue. The class implementation is minimal and focused - it inherits from int, overrides __reduce__ with a documented technique using default arguments to avoid B008 lint issues. Type hints are used consistently. The code is flat with no deep nesting and each action is on its own line. The docstring length is appropriate for the complexity of the concept. Minor deductions: the noqa comment and the `_args=()` default argument pattern may be slightly cryptic for less experienced developers, and some imported modules (abc, contextlib, enum, etc.) appear unused in this snippet, though this is likely part of a larger module. Overall, this is well-structured, readable code with clear intent.
Run 3
The code demonstrates reasonable readability with some minor concerns. The structure is logical and imports are organized into groups (stdlib, third-party, local) with clear naming. The class `_CacheHashWrapper` has a clear purpose documented by a docstring explaining the caching behavior. Nesting is minimal, and action granularity is good with one significant operation per line. However, the code loses points for clarity of intent in the `__reduce__` method, where `_none_constructor` and `_args` default parameters feel like an obscure workaround (hence the noqa comment). The import block is lengthy and could be considered verbose for the remaining code snippet. Reading flow is generally natural but the parameter names like `_none_constructor` and the B008 suppression signal underlying complexity that isn't self-evident. The code is functional and maintainable but could benefit from a comment explaining why the reduce workaround exists beyond what the docstring offers.
Run 1
Code Structure: Imports are grouped coherently, followed by a small, focused class. Nesting: Minimal nesting makes the implementation easy to scan. Clarity of intent: The descriptive class name and detailed docstring clearly explain why cached hashes reset during copying or pickling; the special-method signature requires some Python knowledge. Code length: The implementation is concise, although the extensive imports are disproportionate to the shown functionality. Action granularity: Each statement performs one action, and the return expression is straightforward. Reading flow: The progression from imports to explanation to implementation is natural, though slightly more spacing between import groups and the class would improve visual separation.
Run 2
Code Structure: Imports are grouped logically, followed by a focused class, although many imports are unused in this excerpt. Nesting: The code is shallow, with only a class and its method. Clarity of intent: The descriptive class name and detailed docstring clearly explain why cached hashes reset during copying or pickling; the special-method signature and captured defaults require some Python knowledge. Code length: The implementation is concise, and the longer docstring provides useful context rather than unnecessary detail. Action granularity: Each line performs a single clear action. Reading flow: The progression from imports to explanation to implementation is natural, though the large import block relative to the small implementation and limited spacing between import groups slightly reduce readability.
Run 3
Code Structure: Imports precede a focused class with a single method, providing clear organization, though import grouping could be spaced better. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class name and detailed docstring explain why cached hashes reset during copying or pickling; the specialized __reduce__ defaults require some Python knowledge. Code length: The implementation is concise, although the extensive imports are unused in this excerpt. Action granularity: Each statement performs one clear action. Reading flow: The progression from imports to explanation to implementation is natural, with the long import section slightly delaying the relevant logic.