Sample
pyint-d596f0405d89-SRC
Unmodified source class
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.478 | 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 | 17.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.395 | 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.414 | −6.62 |
Intercept 8.87 + feature contributions = -44.7 (log-odds).
Score = sigmoid(-44.7) = 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.786 | +1.362 |
| 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.481 |
| 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.984 | +0.15 |
Intercept 0.07 + feature contributions = -0.087 (log-odds).
Score = sigmoid(-0.087) = 0.478.
| Score | 0.655 |
|---|
| Score | 58 |
|---|
Run 1
This code demonstrates excellent readability through clear organization, minimal nesting, and logical structure. The class has a clear single responsibility around token generation/verification. Methods are concise and well-named, making intent obvious. Nesting is minimal - the deepest nesting occurs in check_token with try/except blocks and loops, but it's handled cleanly with early returns. Code length is appropriate for the functionality provided. Action granularity is good with one main operation per line, though a few lines like the salted_hmac call chain could be broken up. Reading flow is natural - make_token flows to _make_token_with_timestamp, check_token validates logically step-by-step. Comments explain non-obvious security decisions without being excessive. The use of properties for secret management and clear separation of time-related helper methods contribute to overall maintainability.
Run 2
The code is well-structured and readable overall. The class has a clear single responsibility, with logical separation of public methods (make_token, check_token), internal helpers (_make_token_with_timestamp, _make_hash_value), and property accessors. Nesting is mostly flat: check_token has one level of for/else and early return guards, which keeps the flow manageable. Intent is explicit through meaningful names and clear docstrings. Action granularity is generally good, though some lines (e.g., hash_string assignment) combine several operations. The sliced hexdigest inline comment explains a non-obvious choice. The _make_hash_value method is concise and clearly documents the rationale via comments. Minor drawbacks include slightly dense list construction in check_token and the somewhat terse conditional expression for login_timestamp. Overall, the code is maintainable, follows Django conventions, and balances conciseness with clarity effectively.
Run 3
The code is well-structured and highly readable. It exhibits a clear separation of concerns with private helper methods for token construction, hash value generation, and time calculations. There is no excessive nesting, and each method is concise with a single responsibility. Variable and method names accurately convey their purpose, making the intent clear. The code is appropriately sized for its functionality, avoiding unnecessary verbosity while retaining necessary detail. Each operation is on its own line, and the logical progression from public API to private helpers supports natural reading flow. The only minor deductions are due to the use of some Django-specific utilities which require familiarity, and the somewhat terse token parsing section, but overall this is exemplary code.
Run 1
Code Structure: Well-organized class with focused methods separating configuration, token generation, validation, and hashing. Nesting: Mostly flat, with early returns keeping validation simple; the loop and conditional introduce only shallow nesting. Clarity of intent: Descriptive method names, docstrings, and security-related comments explain purpose well, although abbreviations such as ts_b36 and the loop-else require familiarity. Code length: Appropriately concise for the functionality; the longer hashing docstring provides useful context rather than unnecessary verbosity. Action granularity: Most statements perform one clear action, though the chained HMAC, hexadecimal conversion, and slicing combine several operations. Reading flow: Validation proceeds naturally from parsing to verification to expiration checking. Minor distractions include the awkward multiline slice formatting and a timestamp/uid comment that does not precisely match the implementation.
Run 2
Code Structure: Well-organized class with focused methods separating configuration, token creation, validation, and hashing. Nesting: Shallow overall; early returns keep validation straightforward, though the for-else construct requires familiarity. Clarity of intent: Descriptive names, docstrings, and comments explain both behavior and security rationale; abbreviations such as ts_b36 slightly reduce accessibility. Code length: Appropriately concise for the functionality, with useful rather than excessive documentation. Action granularity: Most statements perform one clear action, although chained HMAC generation and slicing combine several operations. Reading flow: Validation proceeds naturally from parsing to signature verification to expiration checks. Minor interruptions include the awkward multiline hexdigest slicing and indirect property definitions.
Run 3
Code Structure: Well-organized class with focused methods separating configuration, token generation, validation, and hashing. Nesting: Shallow control flow and early returns keep validation easy to follow; the loop-else construct adds minor complexity. Clarity of intent: Descriptive names, docstrings, and comments clearly explain purpose and security considerations, though abbreviations such as ts_b36 require interpretation. Code length: Appropriate for the functionality; lengthy documentation is useful rather than redundant, while property boilerplate adds some overhead. Action granularity: Most statements perform one clear action, although chained HMAC generation and slicing combine several operations. Reading flow: Validation progresses naturally from parsing to verification to expiration checks. The awkward multiline hexdigest slice and less-common loop-else syntax slightly interrupt otherwise smooth reading.