Sample
pyint-0584e01592e1-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.873 | 0–1; higher is more readable |
| Mi | 0.435 | 0–1; higher is more readable |
| LLOC | 18 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 14.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.454 | 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. | 701.154 | −23.138 |
| Source linesThe number of non-empty source lines. | 36 | +14.4 |
| 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.628 | −6.941 |
Intercept 8.87 + feature contributions = -6.809 (log-odds).
Score = sigmoid(-6.809) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| 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. | 69.838 | +0.707 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.034 | +0.609 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 37 | −0.274 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 62.243 | +0.2 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 25 | +0.128 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 35.845 | +0.091 |
Intercept 0.07 + feature contributions = 1.93 (log-odds).
Score = sigmoid(1.93) = 0.873.
| Score | 0.435 |
|---|
| Score | 18 |
|---|
Run 1
The code is generally readable but has a few issues. The structure and intent are clear, with good use of type hints and docstrings. However, the import section is cluttered with multiple overlapping imports (collections.abc as c, MutableMapping imported but unused), creating confusion. The unused 'MutableMapping' import and the import of 'te.Self' without an explicit import statement are problematic. The nesting level is minimal (one inline function), but the 'typing as t' alias combined with the undefined 'te' namespace creates a potential runtime error. Action granularity is good in the __init__ method, though the inline 'on_update' function could be extracted for clarity. The reading flow is mostly natural, starting with imports and moving to class definition, but the unused imports and undefined 'te' reference disrupt the flow. The class attributes are well-documented, which aids comprehension.
Run 2
The code is moderately readable with clear class and method structure. The docstring provides helpful context, and type hints improve clarity. The nesting is shallow, with only one nested function ('on_update'), which is simple and purposeful. However, the scoring is reduced because the nested function's parameter 'self: te.Self' references 'te' which is not imported in the shown code snippet, creating ambiguity. Additionally, the 'SessionMixin' base class is used but not shown or imported, leaving a gap in understanding the full inheritance structure. The imports are somewhat scattered across multiple lines, and aliasing 'collections.abc' as 'c' hurts readability for most readers. Action granularity is good, with one logical action per meaningful line. Overall, the structure and intent are decent, but missing imports and cryptic aliasing prevent higher readability.
Run 3
The code is generally well-structured and readable. It has clear imports, a focused class with a concise docstring, and a straightforward constructor. The nesting level is low, and the intent is clear: a secure cookie session base class. The 'on_update' callback is defined inline but is concise. Some potential issues slightly reduce readability: the import alias 'c' for collections.abc is less explicit, and 'te.Self' appears without a visible import, which could be confusing. The modified attribute is documented well, but the inline callback could be separate for clarity. Overall, flowing and concise, but minor ambiguity in naming and a missing import impact the score.
Run 1
Code Structure: Imports, class documentation, state flag, and initialization are logically organized. Nesting: Shallow overall; the nested callback is appropriate and easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain modification tracking, although SessionMixin and te are not defined or imported in the snippet. Code length: The implementation is concise, but documentation dominates and mentions accessed and new attributes not shown here. Action granularity: Each statement performs one clear action. Reading flow: The progression from session behavior to callback registration is natural, though missing blank lines between imports and the class, abbreviated module aliases, and unresolved references slightly interrupt readability.
Run 2
Code Structure: Imports, class documentation, state, and initialization are logically organized, although several imports are unused in this snippet. Nesting: Shallow overall; the nested callback is a reasonable way to encapsulate update handling. Clarity of intent: Descriptive names, type annotations, and comments clearly explain modification tracking. However, SessionMixin and te.Self are undefined in the provided code, and the documentation mentions attributes not implemented here, making the excerpt less self-contained. Code length: The implementation is concise, though the multiline constructor signature and extensive documentation outweigh the small amount of logic. Action granularity: Each statement performs one clear action. Reading flow: The progression from session behavior to initialization and callback registration is natural, with minor distractions from abbreviated import aliases and missing definitions.
Run 3
Code Structure: Imports, class documentation, state, and initialization are logically organized, although several imports are unused in this excerpt. Nesting: Shallow; the nested callback is small and appropriate. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain modification tracking. However, SessionMixin and te.Self are undefined in the shown code, and the documentation mentions accessed without showing its implementation. Code length: The implementation is concise, though the documentation and multiline signature occupy substantial space relative to the logic. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from class purpose to state and initialization is natural; abbreviated aliases and missing definitions slightly interrupt comprehension.