Sample
pyint-2ae0c9810baf-I10
Deterministically remove some optional blank lines and bracketed line breaks
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0 | 0–1; higher is more readable |
| Dorn | 0.858 | 0–1; higher is more readable |
| Mi | 0.36 | 0–1; higher is more readable |
| LLOC | 17 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 10.67 | 0–20; mean of three runs |
| GPT-6.1 Sol | 14.67 | 0–20; mean of three runs |
| BTTF | 0.689 | 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. | 25 | +10 |
| 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.524 | −6.786 |
Intercept 8.87 + feature contributions = -8.23 (log-odds).
Score = sigmoid(-8.23) = 0.
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. | 79.846 | +0.484 |
| 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.808 | +0.158 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 26 | +0.116 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 24.869 | −0.062 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 22 | +0.024 |
Intercept 0.07 + feature contributions = 1.801 (log-odds).
Score = sigmoid(1.801) = 0.858.
| Score | 0.36 |
|---|
| Score | 17 |
|---|
Run 1
The code has logical organization and a clear class purpose, but it is marred by poor readability choices. The class name references 'SecureCookieSession' even though the defined class is 'NullSession', which creates ambiguity. The error message is clear, but the string contains multiple consecutive spaces in two places, creating formatting noise. The final line assigns six methods to '_fail' on one line, undermining action granularity and disrupting reading flow. This dense assignment makes it harder to immediately understand which methods are overwritten. Import organization is conventional, with clear separation between standard library, third-party, and local modules. However, the unused imports and inconsistent alias usage (like 'collections.abc as c') add clutter. Nesting is flat and simple, and code length is concise, but the technical issues with formatting and assignment compactness reduce overall readability.
Run 2
The code is generally readable but has some issues. The class structure is logical and the docstring clearly explains the purpose. However, there are several problems: the imports are disorganized (mixed standard library and third-party imports, unused imports like hashlib and datetime), the multiline string in the RuntimeError has awkward spacing, and the final line reassigning multiple methods to _fail is confusing without context—it's a clever pattern but hurts readability. The code is relatively flat with minimal nesting, which is good, but the action granularity is mixed—the final assignment line packs multiple operations into one dense line. The reading flow is disrupted by the inconsistent indentation in the raise statement and unclear import organization. Overall, while the intent is discernible, the implementation could benefit from cleaner imports, better formatting, and more explicit handling of the method reassignment pattern.
Run 3
The code structure is logical but the overall readability is impacted by several issues. The nesting is minimal, but the class definition is missing its base class import (SecureCookieSession is not imported in the provided snippet), making the code incomplete. The clarity of intent is adequate for the error message but the assignment of many dunder methods to _fail in a single line reduces action granularity. The code length is concise, but the lack of spacing around the multi-line assignment and the odd indentation of the closing parenthesis in the raise statement hurt the reading flow. Additionally, the use of abbreviated imports like 'collections.abc as c' and 'typing as t' is not utilized in the visible code, which adds unnecessary ambiguity. Overall, the code works but feels cramped and disorganized in places, which reduces its readability despite a straightforward purpose.
Run 1
Code Structure: The class groups related behavior logically, but numerous unused imports and little spacing between imports and the class add clutter. Nesting: Very shallow, with only a class and one method. Clarity of intent: The docstring and descriptive error clearly explain read-only session behavior, although SecureCookieSession is not defined or imported in the snippet. Code length: The implementation is concise, but imports are excessive for the shown functionality. Action granularity: Most lines express one action; the chained assignment of seven methods is compact but requires extra attention. Reading flow: The sequence from documentation to failure handler to method overrides is natural, though the awkward closing-parenthesis placement and deletion of _fail slightly disrupt readability.
Run 2
Code Structure: The class logically groups unavailable-session behavior, but numerous unused imports and an undefined SecureCookieSession base in the snippet weaken its standalone organization. Nesting: Very shallow, making control flow easy to follow. Clarity of intent: The docstring and explicit RuntimeError clearly explain the purpose; assigning all mutating methods to _fail is compact but requires familiarity with Python idioms. Code length: The implementation is concise, though the import block adds unnecessary length for the shown functionality. Action granularity: Most lines perform one action, but the long chained assignment binds seven methods at once, reducing scanability. Reading flow: The progression from documentation to failure behavior to method bindings is natural, but missing spacing before the class, awkward closing-parenthesis formatting, and deleting _fail introduce minor reading friction.
Run 3
Code Structure: The class is logically organized, but unused imports and an undefined SecureCookieSession base class in the snippet weaken self-contained readability. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and explicit RuntimeError clearly explain why writes are forbidden, though chained method aliases require familiarity with Python. Code length: The implementation is concise, but the import list is disproportionate to the functionality shown. Action granularity: Most lines express one action; assigning seven methods in one statement is compact but less immediately readable. Reading flow: The progression from documentation to failure handler to method aliases is natural, but missing separation after imports and awkward closing-parenthesis placement interrupt the flow.