Sample
pyint-d916faee63f1-I05
Rewrite eligible decimal integer literals in hexadecimal notation
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.479 | 0–1; higher is more readable |
| Mi | 0.655 | 0–1; higher is more readable |
| LLOC | 58 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 16.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 17 | 0–20; mean of three runs |
| BTTF | 0.258 | 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. | 2962.12 | −97.75 |
| Source linesThe number of non-empty source lines. | 127 | +50.8 |
| 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.424 | −6.636 |
Intercept 8.87 + feature contributions = -44.716 (log-odds).
Score = sigmoid(-44.716) = 0.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 128 | −3.496 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 97 | +2.618 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 97 | −1.805 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 126.821 | +1.363 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 82.852 | +0.532 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.047 | +0.482 |
| 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. | 82.992 | +0.15 |
Intercept 0.07 + feature contributions = -0.086 (log-odds).
Score = sigmoid(-0.086) = 0.479.
| Score | 0.655 |
|---|
| Score | 58 |
|---|
Run 1
The code is well-structured with clear separation of concerns, good use of properties, and a logical organization of methods. The class follows a consistent pattern with private methods, and the token generation/checking flow is easy to follow. Nesting is minimal with early returns and simple loops. The main readability issue is the use of hex literals (0x7d1, 0x1, 0x2) instead of decimal numbers, which adds unnecessary cognitive load. The `_make_hash_value` method has a moderate length but remains understandable. Some comments help clarify intent, though a few areas like the token parsing could benefit from small explanatory comments. Overall, this code demonstrates strong readability with minor issues around numeric literal choices and occasional verbosity.
Run 2
The code is well-structured and readable overall. It has clear separation of concerns, good use of helper methods, and descriptive naming. The class docstring explains the purpose, and methods have useful comments. However, some readability issues exist: hexadecimal notation like 0x7d1, 0x1, and 0x0 obscures values (2001, 1, 0); the `[::0x2]` slice is cryptic and needs explanation; the token parsing logic in check_token has moderate nesting and multiple early returns that require careful reading. The property accessors add boilerplate complexity, and some lines are dense. The score reflects solid readability with minor clarity issues in numeric literals and token parsing flow.
Run 3
The code is generally readable and well-structured. It follows Django's style conventions with clear method separation and docstrings explaining purpose. Class responsibilities are logical—token generation and verification are cleanly split. The use of properties for secret handling is concise and idiomatic. However, there are a few minor readability issues: the `check_token` method contains multiple early returns and a for-else construct, which slightly disrupts natural flow. The slicing trick `[::0x2]` and hexadecimal constants like `0x7d1` and `0x1` obscure intent without comments. Some inline comments are helpful, but a few expressions (e.g., the timestamp conversion) could be more self-documenting. Overall, the code is maintainable and clear, but could be slightly improved with more explicit constants and less dense logic in a few places.
Run 1
Code Structure: Well-organized class with focused methods separating configuration, token generation, validation, and hashing. Nesting: Shallow overall; early returns simplify validation, although the for-else construct requires extra attention. Clarity of intent: Descriptive names, docstrings, and comments explain the purpose and security rationale. Hexadecimal literals for ordinary dates, zero, and slice steps unnecessarily obscure meaning. Code length: Mostly concise; extensive documentation is useful rather than redundant, though property boilerplate adds some length. Action granularity: Most lines perform one clear action; the chained HMAC, hexadecimal slicing, and compact conditional expression are slightly harder to scan. Reading flow: Validation follows a natural sequence from parsing through verification to expiration checking. The awkwardly wrapped hexdigest slice interrupts otherwise consistent formatting.
Run 2
Code Structure: Well-organized class with focused methods separating configuration, token generation, validation, and hashing. Nesting: Mostly flat, with early returns keeping validation straightforward; the loop and conditional add only modest nesting. Clarity of intent: Descriptive names, docstrings, and comments explain the purpose and security rationale. However, hexadecimal literals for ordinary dates, zero, and slice steps obscure otherwise simple operations. Code length: Reasonably concise; configuration accessors and detailed documentation add length but serve clear purposes. Action granularity: Most statements perform one action, although chained HMAC generation and slicing combine several operations. Reading flow: Validation follows a natural parse, verify, and expiration-check sequence. The loop-else construct requires familiarity, and the awkward multiline hexdigest slice interrupts the flow slightly.
Run 3
Code Structure: Well-organized class with focused methods separating configuration, token generation, validation, and hashing. Nesting: Mostly flat, with early returns keeping validation easy to follow; the loop adds little depth. Clarity of intent: Descriptive names, docstrings, and security-related comments clearly explain the purpose, although hexadecimal literals for ordinary dates, zero, and slice steps unnecessarily obscure meaning. Code length: Appropriately concise for the functionality; documentation adds useful context rather than excessive verbosity. Action granularity: Most statements perform one clear action, though the chained HMAC, hexadecimal conversion, and slicing expression is visually awkward. Reading flow: Validation follows a natural parse, verify, and expiration-check sequence. Minor friction comes from the less familiar for-else construct, property accessor boilerplate, and unusual multiline slice formatting.