Sample
pyint-58985f40358a-I12
Inline all eligible single-use intermediate local variables
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.001 | 0–1; higher is more readable |
| Dorn | 0.861 | 0–1; higher is more readable |
| Mi | 0.359 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 15.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs |
| BTTF | 0.704 | 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. | 615.58 | −20.314 |
| Source linesThe number of non-empty source lines. | 27 | +10.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.527 | −6.791 |
Intercept 8.87 + feature contributions = -7.435 (log-odds).
Score = sigmoid(-7.435) = 0.001.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.034 | +0.614 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 80.071 | +0.487 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| 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.893 | +0.154 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 24 | +0.093 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 28 | +0.045 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 26.857 | −0.034 |
Intercept 0.07 + feature contributions = 1.827 (log-odds).
Score = sigmoid(1.827) = 0.861.
| Score | 0.359 |
|---|
| Score | 17 |
|---|
Run 1
The code is highly readable, with clear imports, a single purpose, and a clean class definition. The NullSession class is logically structured, and the _fail method clearly communicates intent with a descriptive error message. Nesting is minimal, and each assignment of methods to _fail is concise. Action granularity is well handled, as the method aliasing is compact but still understandable. The only minor drawback is the slight ambiguity in the import of collections.abc as c, which is unused, but this does not significantly impact readability.
Run 2
The code is generally readable but has some issues. Structure is logical with a clear class definition and docstring. Nesting is minimal, which is good. The intent is clear - providing a session class that fails gracefully when no secret key is set. Code length is appropriate - concise but not too terse. The main readability issue is the last line where multiple methods are assigned in a single line, which reduces clarity and makes the code harder to scan. The imports at the top feel slightly cluttered with unused imports (MutableMapping, datetime, timezone, hashlib, BadSignature, URLSafeTimedSerializer, CallbackDict, TaggedJSONSerializer) which could confuse readers about what's actually needed. The error message is clear and helpful. Type hints are used appropriately where present. The reading flow is mostly natural - docstring explains purpose, then the failure method, then the mass assignment of methods. The mass assignment could be split for better readability.
Run 3
The code is moderately readable. It has clear intent with a docstring explaining the 'NullSession' purpose and a concise '_fail' method that provides a helpful error message. The structure is logical, with the class inheriting from 'SecureCookieSession' and assigning multiple methods to '_fail' in one line, which is concise but slightly reduces action granularity. The nesting is flat, which is good, but the 'del _fail' at the end is somewhat confusing—it removes the helper method after use, which may obscure intent for readers unfamiliar with this pattern. The import block includes several unused or redundant imports (e.g., 'hashlib', 'datetime', 'itsdangerous', 'MutableMapping', 'CallbackDict', 'TaggedJSONSerializer'), which adds noise and reduces clarity. Overall, the code is understandable but could be improved by removing unused imports and clarifying the method reassignment pattern.
Run 1
Code Structure: The class is logically organized around a single failure handler, though numerous unused imports and the undefined-in-snippet base class add clutter and missing context. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and descriptive error message clearly explain read-only behavior when sessions are unavailable. Code length: The implementation is concise, but the imports are disproportionate to the shown functionality. Action granularity: Most lines perform one action; the chained assignment binds seven mutation methods at once, reducing immediate readability. Reading flow: The progression from documentation to error handling to method bindings is natural, although the dense assignment and deletion of the helper require familiarity with Python class mechanics.
Run 2
Code Structure: The class is logically organized, although numerous unused imports and the missing SecureCookieSession definition distract in this isolated snippet. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The docstring and explicit error message clearly explain read-only behavior and why modifications fail. Code length: The implementation is concise, though the imports add unnecessary length here. Action granularity: Most lines express a single action, but chaining seven method assignments into one line makes the overridden operations harder to scan. Reading flow: The progression from class documentation to failure handling to method overrides is natural; deleting _fail and the compact alias assignment require some familiarity with Python class construction.
Run 3
Code Structure: The class is logically organized, with a descriptive docstring and a centralized failure handler, though many imports are unused in this snippet and the base class is not shown. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and explicit error message clearly explain why session mutations fail. Code length: The implementation is concise without redundant method definitions. Action granularity: Most lines express a single action, but the chained assignment binds seven methods at once, increasing cognitive load. Reading flow: The progression from documentation to handler to method bindings is natural, although the dense assignment and deletion of _fail require familiarity with Python class construction.