Sample

pyint-b6057b665be9-I04

Replace names with deterministic minifier-style shortest identifiers

Matched original source

Lines36

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8730–1; higher is more readable
Mi0.430–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol15.670–20; mean of three runs
BTTF0.460–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 SecureCookieSession(CallbackDict[str, t.Any], SessionMixin): """Base class for sessions based on signed cookies. This session backend will set the :attr:`modified` and :attr:`accessed` attributes. It cannot reliably track whether a session is new (vs. empty), so :attr:`new` remains hard coded to ``False``. """ #: When data is changed, this is set to ``True``. Only the session #: dictionary itself is tracked; if the session contains mutable #: data (for example a nested dict) then this must be set to #: ``True`` manually when modifying that data. The session cookie #: will only be written to the response if this is ``True``. modified = False def __init__( self, a: c.Mapping[str, t.Any] | None = None, ) -> None: def on_update(self: te.Self) -> None: self.modified = True super().__init__(a, on_update)

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.701.154−23.138
Source linesThe number of non-empty source lines.36+14.4
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.631−6.946

Intercept 8.87 + feature contributions = -6.814 (log-odds).
Score = sigmoid(-6.814) = 0.001.

Feature contributions

FeatureValueContribution
(log-odds)
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.69.838+0.707
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.035+0.606
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.37−0.274
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.62.243+0.2
Indentation frequencyHow rapidly indentation changes from line to line.25+0.128
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.35.845+0.091

Intercept 0.07 + feature contributions = 1.926 (log-odds).
Score = sigmoid(1.926) = 0.873.

Score0.43
Score18
Run 1

The code is generally organized but has readability issues that prevent a higher score. The class has a clear purpose and the docstring is helpful for understanding behavior. However, several points hurt clarity: the type alias 'c' for collections.abc feels unnecessarily abbreviated, and the parameter 'a' is ambiguous (should be 'initial_data' or similar). The 'te.Self' reference appears undefined in this snippet, creating confusion. The nesting is minimal and flow is straightforward, with one action per line mostly followed. The imports are slightly disorganized with duplicates from collections.abc and some unused imports (datetime, hashlib, serializer). Given these clarity issues, the score lands below 15 despite good structure and low nesting.

Run 2

The code is generally readable with a clear class structure, appropriate type hints, and well-documented behavior via docstrings and comments. The inheritance chain and import patterns are logical. Minor deducts: the single-parameter constructor using a generic Mapping type is fine but the nested `on_update` callback adds slight nesting; import alias `te` is referenced but not imported in the shown snippet, which would break clarity. The variable name `a` for the initial mapping is unnecessarily short and ambiguous. Overall, intent is clear, nesting is minimal, and each action is on its own line.

Run 3

The code is moderately readable but has several issues. It imports collections.abc twice (once as 'c' and once as MutableMapping), creating redundancy. The namespace import 'c' obscures clarity, and MutableMapping is imported but unused. The 'te.Self' reference in the inner function is undefined (likely a typo), breaking the code and obscuring intent. The class and docstring are clear, but the `__init__` method uses a nested function solely to set a boolean flag, which adds unnecessary nesting and hampers reading flow. The parameter 'a' is poorly named; 'initial' or 'data' would be more descriptive. Type hints are used but inconsistently (e.g., missing return annotation on the nested function). The docstring is informative, yet the code could be simplified by using a lambda or a method. Overall, the structure is logical but impeded by minor errors, redundant imports, and unclear naming, making it only somewhat readable.

Run 1

Code Structure: Imports, class documentation, state, and initialization are logically organized, although several imports are unused and SessionMixin and te are undefined in the snippet. Nesting: Only a small callback is nested inside the constructor, keeping complexity low. Clarity of intent: The class name, docstring, and detailed comment explain signed-cookie sessions and modification tracking well, but the parameter name 'a' is vague, and documentation mentions accessed without showing its implementation. Code length: The implementation is concise, though the import list and multiline constructor signature add unnecessary visual overhead for this small excerpt. Action granularity: Each statement performs one clear action. Reading flow: The progression from documentation to state initialization to callback registration is natural, but unresolved names and abbreviated aliases interrupt comprehension.

Run 2

Code Structure: Imports, class documentation, state, and initialization are logically organized. Nesting: Only one small nested callback, keeping complexity low. Clarity of intent: The class and comments clearly describe signed-cookie session behavior and modification tracking, but the parameter name 'a' is vague, and SessionMixin and te.Self are undefined in the provided snippet. The documentation also mentions accessed without showing its implementation. Code length: The implementation is concise, though documentation is relatively lengthy and several imports are unused here. Action granularity: Each statement performs a single clear action. Reading flow: The progression from class purpose to state and initialization is natural, although missing definitions and abbreviated aliases interrupt comprehension.

Run 3

Code Structure: Imports, class documentation, state, and initialization are logically organized, although several imports are unused in this snippet. Nesting: Shallow; the nested callback is small and appropriate. Clarity of intent: Documentation clearly explains cookie-session behavior and modification tracking, but the parameter name 'a' is vague, and SessionMixin and te.Self are not defined or imported in the shown code. Code length: The implementation is concise, though the lengthy documentation and multiline signature outweigh the small amount of executable code. Action granularity: Each executable line performs one clear action. Reading flow: The progression from class purpose to state initialization and update handling is natural; unexplained type references and terse aliases cause minor interruptions.