Sample
pyint-ccf455e964fe-I13
Lower every eligible synchronous for loop to a while loop
Scores
| Method | Score | Scale |
|---|---|---|
| Posnett | 0.02 | 0–1; higher is more readable |
| Dorn | 0.858 | 0–1; higher is more readable |
| Mi | 0.584 | 0–1; higher is more readable |
| LLOC | 22 | Logical lines; fewer is more readable |
| DeepSeek V4 Pro | 17.33 | 0–20; mean of three runs |
| GPT-6.1 Sol | 18 | 0–20; mean of three runs |
| BTTF | 0.747 | 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. | 696.883 | −22.997 |
| Source linesThe number of non-empty source lines. | 43 | +17.2 |
| 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.653 | −6.979 |
Intercept 8.87 + feature contributions = -3.906 (log-odds).
Score = sigmoid(-3.906) = 0.02.
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.026 | +0.69 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 44 | −0.522 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 1 | +0.398 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 73.795 | +0.386 |
| 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. | 78.909 | +0.323 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 29 | +0.266 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 42.875 | +0.189 |
Intercept 0.07 + feature contributions = 1.801 (log-odds).
Score = sigmoid(1.801) = 0.858.
| Score | 0.584 |
|---|
| Score | 22 |
|---|
Run 1
The code is well-structured with clear class definition and logical grouping of properties and attributes. Nesting is minimal—only one class and no deep indentation. The intent is clear: extending a dictionary with session-specific behavior. Code length is concise; each property is short and focused. Action granularity is appropriate, with one logical action per line. Reading flow is natural, moving from imports to class definition to documented attributes. Type hints and docstrings improve understandability. Minor deductions include a couple of slightly long lines and mixed import styles, but overall readability is strong.
Run 2
The code is highly readable with clear structure and intent. Class definition and inheritance are explicit, and the property setter/getter for 'permanent' is cleanly implemented with docstrings explaining behavior. Import statements are logically organized, though some unused imports (hashlib, datetime, timezone, BadSignature, URLSafeTimedSerializer, CallbackDict, TaggedJSONSerializer) slightly reduce clarity. The class attributes 'new', 'modified', and 'accessed' are documented via comments and docstrings, aiding comprehension. Nesting is minimal. One minor improvement could be removing unused imports to reduce cognitive load. Overall, the code follows good Python practices and maintains a natural reading flow.
Run 3
The code is well-structured with clear separation of concerns: a single SessionMixin class extending MutableMapping with documented attributes. Nesting is flat and action granularity is appropriate - each line performs one logical operation. Clarity of intent is excellent, with descriptive property names (permanent, new, modified, accessed) and comprehensive docstrings explaining behavior. The property setter correctly coerces values to bool, and the getter uses a sensible default. Imports are organized and typed properly with from __future__ import annotations. The code length is concise yet complete for the functionality provided. Reading flow is natural, progressing from imports to class definition to properties and attributes. Minor deductions: a type ignore comment and slightly verbose docstrings for simple attributes, but these don't significantly impact readability. Some imports (hashlib, datetime, itsdangerous) appear unused in this snippet, which could cause minor confusion.
Run 1
Code Structure: Imports and session attributes are logically organized within a focused mixin, though import grouping could be clearer. Nesting: Methods are flat, with no complex control flow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain session behavior; abbreviated import aliases and the type-ignore comment add minor friction. Code length: The implementation is concise, although documentation occupies most of the snippet and some imports are unused here. Action granularity: Each executable line performs one clear action. Reading flow: The getter and setter appear together, followed by related flags, creating a natural progression. Mixed documentation styles—preceding comments versus a trailing attribute docstring—slightly interrupt consistency.
Run 2
Code Structure: Imports and a single focused mixin are logically organized, though import grouping could be clearer. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive session attributes, type annotations, and documentation clearly explain behavior; abbreviated import aliases are slightly less explicit. Code length: The implementation is concise, with documentation longer than the executable code but generally useful. Action granularity: Each executable line performs one clear action. Reading flow: The property getter and setter appear together, followed by session-state defaults in a natural sequence. Mixed documentation styles and uneven comment detail slightly disrupt consistency.
Run 3
Code Structure: Imports and a focused mixin class provide logical organization, though several imports are unused in this snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive attribute names, type annotations, and documentation clearly explain session behavior; abbreviated import aliases are slightly less intuitive. Code length: The implementation is concise, although documentation is lengthy relative to the executable code. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The getter, setter, and session flags follow a natural progression. Mixed documentation styles and limited separation between imports and the class slightly interrupt visual consistency.