Sample

pyint-3dac93ff84d0-I01

Remove comments and docstrings

Matched original source

Lines43

Scores

MethodScoreScale
Posnett0.0370–1; higher is more readable
Dorn0.8690–1; higher is more readable
Mi0.6650–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.690–1; higher is more readable

Views

Source code

from __future__ import annotations import collections.abc as c import hashlib import typing as t from collections.abc import MutableMapping from datetime import datetime from datetime import timezone from itsdangerous import BadSignature from itsdangerous import URLSafeTimedSerializer from werkzeug.datastructures import CallbackDict from .json.tag import TaggedJSONSerializer class SessionMixin(MutableMapping[str, t.Any]): @property def permanent(self) -> bool: return self.get("_permanent", False) @permanent.setter def permanent(self, value: bool) -> None: self["_permanent"] = bool(value) new = False modified = True accessed = False """Indicates if the session was accessed, even if it was not modified. This is set when the session object is accessed through the request context, including the global :data:`.session` proxy. A ``Vary: cookie`` header will be added if this is ``True``. .. versionchanged:: 3.1.3 This is tracked by the request context. """

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.679.077−22.41
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.607−6.91

Intercept 8.87 + feature contributions = -3.25 (log-odds).
Score = sigmoid(-3.25) = 0.037.

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.038+0.57
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.44−0.522
Indentation frequencyHow rapidly indentation changes from line to line.36+0.508
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.72+0.357
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
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.894 (log-odds).
Score = sigmoid(1.894) = 0.869.

Score0.665
Score20
Run 1

The code is relatively readable due to clear imports, type hints, and docstrings explaining key attributes like 'accessed'. However, several factors reduce clarity: the class inherits from MutableMapping but has empty methods/properties with only docstrings and pass-like behavior, making intent ambiguous. The 'new' and 'modified' attributes lack docstrings or clear purpose, appearing as declarations with no initial values. The code includes multiple blank lines and commented-out sections that feel like scaffolding rather than complete implementation. While the action granularity is appropriate and structure is logical enough, the incomplete method bodies and unexplained attributes make it difficult to understand the full behavior at a glance. The reading flow is interrupted by inconsistent spacing and unclear attribute roles. Overall, it is readable in terms of syntax but less so in terms of complete, self-explanatory logic.

Run 2

The code is moderately readable but has several issues. The structure is logical with clear class definition, but has excessive blank lines and misplaced docstrings. The nesting is flat (positive), and intent for 'permanent' property is clear, but other attributes like 'new' and 'modified' lack clarity despite their docstring attempts. The import section is slightly disorganized with unused imports ('hashlib', 'datetime', 'itsdangerous') and inconsistent import styles threatening readability. Action granularity is good - one action per line in the setter. Reading flow is disrupted by docstring placement and formatting inconsistencies. The code is concise but could benefit from cleanup of unused imports and better organization of class attributes with their docstrings.

Run 3

The code is generally readable but has some issues. The class structure is logical and the type annotations are good, but there are several problems: multiple blank lines with whitespace between methods (lines 13-15, 20-23) suggest incomplete code or accidental spacing, the import of 'c' as collections.abc is unused, and the class variables 'new', 'modified', and 'accessed' are positioned awkwardly between methods without clear organization. The property methods are clear and concise, but the excessive blank lines disrupt reading flow. The docstring is helpful but placed far from the variable it documents. The class inheritance and imports show good intent but could be cleaner - importing both 'c' and 'MutableMapping' from the same module is redundant. Overall, the code structure needs minor cleanup to improve consistency and remove dead code.

Run 1

Code Structure: The mixin logically groups session properties and state flags, but unused imports and excessive blank lines add clutter. Nesting: Very shallow, with straightforward property methods. Clarity of intent: The permanent getter/setter and session flags are understandable; the accessed documentation is helpful, but new and modified lack explanations. Code length: The functional code is concise, although whitespace and imports make the snippet unnecessarily long. Action granularity: Each statement performs a single clear action. Reading flow: The getter and setter read naturally, but irregular spacing disrupts the transition to the class attributes.

Run 2

Code Structure: The mixin is logically organized around a session property and state flags, although numerous unused imports distract from the small implementation. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names, type annotations, and the accessed documentation clarify behavior, but new and modified lack explanations. Code length: The implementation is concise, yet excessive blank lines and imports add unnecessary visual length. Action granularity: Each statement performs one clear action. Reading flow: The getter and setter appear together naturally, followed by related flags; inconsistent whitespace and uneven documentation interrupt an otherwise straightforward flow.

Run 3

Code Structure: Imports and the session mixin are logically organized, though several imports are unused in this snippet and excessive blank lines interrupt grouping. Nesting: Very shallow, with straightforward property methods and class attributes. Clarity of intent: The permanent getter and setter are clear, and accessed has useful documentation; however, new and modified lack explanations, and abbreviated import aliases reduce immediate clarity. Code length: Functional code is concise, but redundant whitespace and unused imports add visual clutter. Action granularity: Each statement performs one action, making operations easy to follow. Reading flow: The getter-to-setter sequence reads naturally, followed by related state flags, but inconsistent spacing and uneven documentation weaken the overall flow.