Sample
pyint-2ce6ab591f60-I06
Invert eligible conditions and exchange their branches
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.67 | 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 moderately readable. Structure is logical: a single class with a clear docstring explaining its purpose. Intent is understandable—it creates a session class that allows read access but prevents modifications with helpful errors. Action granularity is good, with one assignment line mapping multiple mutating methods to the failure function. Length is concise. However, readability is reduced by the dense assignment line ' __setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail', which packs many operations into one line, making it harder to scan. The 'del _fail' line is also slightly obscure without context, though it prevents the helper method from being exposed. Imports include some unused or indirectly used modules (e.g., hashlib, datetime, itsdangerous) which adds noise. Nesting is flat, which is good. Overall, the code is clear to an experienced Flask developer but less approachable to a beginner due to the terse multi-method assignment and unexplained deletion of '_fail'.
Run 3
The code is logically organized and relatively concise, but several readability issues reduce its clarity. The import block is unnecessarily fragmented (splitting collections.abc and itsdangerous imports across multiple lines) and includes an unused alias 'c'. The class definition is clear with a reasonable docstring, and the _fail method has a clear purpose. However, the assignment line chaining multiple dunder methods to _fail is overly condensed and violates the 'one action per line' principle, making it harder to quickly understand which methods are being overridden. The trailing 'del _fail' is a clever cleanup but adds cognitive overhead. Nesting is minimal and the reading flow is generally natural, but the cryptic compression of multiple actions on one line and the scattered imports drag down overall readability. Type hints are present but sparse.
Run 1
Code Structure: The class is logically organized around a single failure handler, though numerous unused imports and an undefined base class in this snippet distract. Nesting: Minimal nesting makes it easy to scan. Clarity of intent: The docstring and informative error message clearly explain read-only behavior when sessions are unavailable. Code length: The implementation is concise, but the imports add unnecessary length for the displayed code. Action granularity: Most lines perform one action; the chained assignment binds seven methods at once, requiring extra attention. Reading flow: The progression from documentation to error handler to method bindings is natural, although the dense assignment and deletion of the helper slightly interrupt readability.
Run 2
Code Structure: The class is logically organized, although numerous unused imports and the absent SecureCookieSession definition add distracting or missing context. Nesting: Very shallow, making control flow easy to follow. Clarity of intent: The docstring and explicit error message clearly explain the read-only fallback behavior. Code length: The implementation is concise, but the imports outweigh the functional code. Action granularity: Most statements perform one action; the chained assignment compactly binds several mutation methods but requires extra attention. Reading flow: The progression from documentation to failure handler to method bindings is natural, though the long assignment and deletion of _fail make the ending less immediately intuitive.
Run 3
Code Structure: The class is logically organized, although numerous unused imports and the absent SecureCookieSession definition reduce standalone readability. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The docstring and explicit error message clearly explain why writes fail, though the chained method aliases require familiarity with Python. Code length: The implementation is concise, but the imports add unnecessary length to this excerpt. Action granularity: Most statements perform one action; assigning seven mutation methods in one line makes that line harder to scan. Reading flow: The progression from documentation to failure handler to method bindings is natural, but deleting _fail and using dense chained assignment introduce small readability hurdles.