Sample

pyint-31df94551093-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines43

Scores

MethodScoreScale
Posnett0.020–1; higher is more readable
Dorn0.8570–1; higher is more readable
Mi0.5840–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro14.670–20; mean of three runs
GPT-6.1 Sol12.670–20; mean of three runs
BTTF0.750–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 b(self) -> bool: """This reflects the ``'_permanent'`` key in the dict.""" return self.get("_permanent", False) # type: ignore[no-any-return] @permanent.setter def b(self, c: bool) -> None: self["_permanent"] = bool(c) #: 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.652−6.978

Intercept 8.87 + feature contributions = -3.905 (log-odds).
Score = sigmoid(-3.905) = 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.686
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.955+0.321
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.788+0.188

Intercept 0.07 + feature contributions = 1.794 (log-odds).
Score = sigmoid(1.794) = 0.857.

Score0.584
Score22
Run 1

The code is generally readable with clear structure and intent. It defines a SessionMixin class with a property, attributes, and docstrings. However, there are notable issues: the property is named 'b' (ambiguous) while the parameter is 'c' (also unclear), which obscures intent. The mixing of type annotations (typing as t, collections.abc as c) is inconsistent with standard conventions. The docstrings are helpful but some comments feel redundant. The nesting is minimal, and the action granularity is appropriate, with one concept per line. Overall, the code is understandable but suffers from poor naming choices and slightly inconsistent style, preventing it from being highly readable.

Run 2

The code is generally readable but has notable issues. The structure is logical with a clear class definition and property, but the use of single-letter variable names ('b' for property, 'c' for setter parameter) reduces clarity and feels cryptic. The mixin provides good documentation via docstrings, which helps intent. Nesting is minimal, which is positive. However, the action granularity is clear—one action per line—but the code length is slightly padded by comments for simple attributes. Reading flow is natural, starting with imports and moving to class definition. The main detractor is the poor naming convention for the 'permanent' property and its setter, which hurts clarity of intent. Also, the 'b' property name doesn't reflect its purpose, making it hard to understand without reading docstrings. Overall, it's readable but could improve with better naming and removing some comments.

Run 3

The code has a clear purpose (session mixin) and includes helpful documentation. The class structure is logical, and the property decorator pattern for 'permanent' is straightforward. However, significant readability issues exist. The most obvious is the use of 'b' as both the property name and parameter name, which obscures intent completely. The property is documented as reflecting '_permanent' but named 'b' - a confusing mismatch. The parameter 'c' also lacks descriptive value. Several attributes (new, modified, accessed) mix class attributes with instance attributes, creating potential confusion about their scope. The docstring placement for 'accessed' after the attribute is inconsistent with its preceding comment style. Import aliasing (collections.abc as c) is unnecessary and confusing when the class already imports MutableMapping separately. While the code is concise and flat, the unclear naming and inconsistent documentation style reduce readability below what would be expected for this otherwise simple class.

Run 1

1. Code Structure: Imports and session attributes are logically grouped, though several imports are unused in this snippet. 2. Nesting: Minimal nesting makes the code easy to scan. 3. Clarity of intent: The class docstring and attribute documentation explain session behavior, but names such as b and c obscure meaning. The @permanent.setter decorator references an undefined property rather than b, creating a confusing inconsistency. 4. Code length: The implementation is concise, although comments and version metadata occupy substantially more space than the behavior. 5. Action granularity: Each statement performs one action, with no compressed multi-action lines. 6. Reading flow: The progression from imports to property methods and default attributes is natural, but inconsistent naming and mixed documentation styles interrupt comprehension.

Run 2

Code Structure: The mixin logically groups session attributes, but unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Docstrings explain session behavior, but naming the property and setter 'b' and its parameter 'c' obscures their purpose. The decorator '@permanent.setter' references an undefined name rather than the declared property, creating a major mismatch between intent and implementation. Code length: The implementation is concise, though imports and lengthy documentation outweigh the executable code. Action granularity: Each statement performs a single action. Reading flow: The progression from property to session flags is natural, but cryptic names, the mismatched decorator, and inconsistent documentation placement interrupt comprehension.

Run 3

Code Structure: Imports and session attributes are logically grouped, but unused imports add clutter. Nesting: The class and short methods have minimal nesting. Clarity of intent: The class docstring and attribute documentation explain session behavior, but names such as 'b' and 'c' obscure meaning. The setter references '@permanent.setter' even though the property is named 'b', creating a significant inconsistency and an undefined reference. Code length: Methods are concise, although extensive documentation dominates this small snippet. Action granularity: Each executable line performs one clear action. Reading flow: The progression from property to session flags is reasonable, but inconsistent naming and mixed documentation styles interrupt comprehension.