Sample
pyint-1815010b9f6e-I05
Rewrite eligible decimal integer literals in hexadecimal notation
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 | 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. It has clear structure with logical imports and a well-documented class. The `_CacheHashWrapper` class has a single, focused responsibility and its purpose is explained succinctly in the docstring. Nesting is minimal. The `__reduce__` method uses keyword arguments for clarity. Function names and comments convey intent effectively. The code is concise and follows Python conventions, making the reading flow natural and easy to follow.
Run 3
The code is well-structured and readable. It begins with a clear import section, including standard library, typing, and relative imports, which aids understanding of dependencies. The class `_CacheHashWrapper` is logically placed with a docstring explaining its purpose and rationale. Nesting is minimal; the class has a single method with no deep indentation. The intent is clearly conveyed through naming and comments. Code length is appropriate for the functionality. Action granularity is good—each line performs a distinct operation. The reading flow is natural, moving from imports to class definition to method. Minor deductions: the use of `# noqa: B008` and default argument `_none_constructor=type(None)` could be slightly clearer, and the import alias `PY_3_11_PLUS` etc. are not used in this snippet, but these do not significantly harm readability.
Run 1
Code Structure: Imports precede a focused class definition, providing logical organization, though the many 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; the specialized __reduce__ signature requires some Python knowledge. Code length: The implementation is concise, with documentation proportionate to the non-obvious behavior. Action granularity: Each import and the single return statement occupy separate lines without compounded actions. Reading flow: The progression from imports to explanation to implementation is natural, although an additional blank line before the top-level class would improve conventional formatting.
Run 2
Code Structure: Imports are grouped sensibly, followed by a focused class with a single method. 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 specialized __reduce__ signature requires some Python knowledge. Code length: The implementation is concise, though the extensive imports appear disproportionate to this excerpt. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from imports to explanation to implementation is natural, although additional blank lines between import groups and before the class would improve visual separation.
Run 3
Code Structure: Imports are grouped logically, followed by a small, focused class, although many 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; the special method and default arguments require some Python-specific knowledge. Code length: The implementation is concise, and the documentation provides useful context without excessive detail. Action granularity: Each line performs a single action, with a straightforward tuple return. Reading flow: The progression from imports to explanation to implementation is natural, though the large import block slightly outweighs the small amount of executable code.