Sample

pyint-82d5e16c6695-SRC

Unmodified source class

Lines43

Scores

MethodScoreScale
Posnett0.020–1; higher is more readable
Dorn0.8580–1; higher is more readable
Mi0.5840–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro16.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.7470–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]): """Expands a basic dictionary with session attributes.""" @property def permanent(self) -> bool: """This reflects the ``'_permanent'`` key in the dict.""" return self.get("_permanent", False) # type: ignore[no-any-return] @permanent.setter def permanent(self, value: bool) -> None: self["_permanent"] = bool(value) #: Some implementations can detect whether a session is newly #: created, but that is not guaranteed. Use with caution. The mixin # default is hard-coded ``False``. new = False #: Some implementations can detect changes to the session and set #: this when that happens. The mixin default is hard coded to #: ``True``. 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.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

FeatureValueContribution
(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.

Score0.584
Score22
Run 1

The code is highly readable with clear structure and intent. It defines a SessionMixin class extending MutableMapping, with well-documented attributes using docstrings and comments. Each property method is concise and serves a single purpose, maintaining flat nesting and natural reading flow. Type hints improve clarity. The only minor drawbacks are slightly verbose imports (some unused or redundant) and a class-level attribute 'accessed' placed after its docstring, which slightly disrupts logical grouping. Overall, the code is well-organized, maintainable, and easy to understand.

Run 2

The code is highly readable with clear structure and purpose. It defines a SessionMixin class with well-documented properties and attributes. Each method has a single responsibility, with clean type hints and minimal nesting. The use of property decorators for 'permanent' is logical and maintains good action granularity. Docstrings and comments provide context without being excessive. Minor deductions: some attributes are declared inline (new, modified, accessed), which slightly interrupts the flow, and the 'accessed' attribute has its docstring after it rather than before, breaking consistency. Import aliasing (collections.abc as c, typing as t) is standard but adds slight cognitive overhead. Overall, the code follows Python best practices, maintains flat structure, and clearly communicates intent through naming and documentation.

Run 3

The code demonstrates good organization with clear class structure and docstrings that explain intent, making it relatively readable. However, several issues prevent a higher score: unnecessary and inconsistent imports create confusion (mixing 'collections.abc as c' with 'from collections.abc import MutableMapping', alongside unused imports). The class attributes are interspersed between methods, disrupting natural reading flow. Multiple actions occur in the property getter at the type-ignore comment line, though this is minor. The docstring placement after 'accessed = False' is unconventional as it appears to document the attribute below it but is positioned after the assignment. While the structure is logical and nesting is flat, the import redundancy and attribute placement reduce clarity and create a slightly disorganized feel relative to what could be cleaner with better consolidation and alignment.

Run 1

Code Structure: Imports and a single focused mixin are logically organized, although imports could be grouped more clearly. Nesting: Minimal nesting makes the property getter and setter easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain session attributes; abbreviated import aliases slightly reduce clarity. Code length: Implementation is concise, though documentation occupies most of the snippet and some imports are unused here. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The progression from the permanent property to session-state attributes is natural. Mixed documentation styles and the intervening version note add minor visual overhead.

Run 2

Code Structure: Imports and a single focused mixin provide logical organization, although import grouping could be cleaner. Nesting: Minimal nesting makes the property getter and setter easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain session behavior; abbreviated import aliases are slightly less intuitive. Code length: The implementation is concise, though documentation and imports occupy much of this excerpt. Action granularity: Each executable line performs one clear action. Reading flow: The progression from the class description to the permanent property and session flags is natural. Mixed documentation styles for attributes slightly reduce consistency.

Run 3

Code Structure: Imports and a single focused mixin are logically organized, though several imports are unused in this excerpt. Nesting: Minimal nesting makes the property methods easy to follow. Clarity of intent: Descriptive names, type annotations, and documentation clearly explain session attributes and defaults; abbreviated import aliases are slightly less intuitive. Code length: The implementation is concise, although documentation occupies substantially more space than executable code. Action granularity: Each executable line performs one clear action. Reading flow: The class progresses naturally from the permanent property to session state flags, but inconsistent documentation styles and the version-change note slightly interrupt the flow.