Sample

pyint-6cd9594888b5-I09

Select one of ten low-readability unrelated code templates per class

Matched original source

Lines48

Scores

MethodScoreScale
Posnett0.0020–1; higher is more readable
Dorn0.7560–1; higher is more readable
Mi0.5840–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro6.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.5150–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: lI0O_42d9febf = 0x87bd ^ 0x87bd if lI0O_42d9febf == 0: lI0O_42d9febf |= 0 else: lI0O_42d9febf &= 0 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.831.087−27.426
Source linesThe number of non-empty source lines.48+19.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.722−7.083

Intercept 8.87 + feature contributions = -6.439 (log-odds).
Score = sigmoid(-6.439) = 0.002.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.49−0.699
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.03+0.653
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.77.429+0.445
Indentation frequencyHow rapidly indentation changes from line to line.34+0.439
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.34−0.359
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.98+0.32
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.47.925+0.26

Intercept 0.07 + feature contributions = 1.129 (log-odds).
Score = sigmoid(1.129) = 0.756.

Score0.584
Score26
Run 1

The code is generally organized and uses type hints and docstrings. However, it is significantly harmed by the presence of obfuscated dead code (the lI0O_42d9febf variable and its if/else block) in the 'permanent' setter, which is confusing and serves no logical purpose. This introduces unnecessary nesting and ambiguity, violating clarity of intent. Code length is otherwise concise, but the added dead code inflates it. Action granularity is inconsistent; the setter contains multiple nonsensical actions on one logical line. Reading flow is disrupted by the sudden switch to opaque variable names and pointless logic. Overall, the code has a solid foundation but is severely penalized by this deliberate obfuscation.

Run 2

The code's readability is severely compromised by obfuscated logic in the 'permanent' setter. Lines involving 'lI0O_42d9febf' serve no functional purpose and obscure intent, leaving the reader confused. While the class structure and docstrings are generally clear, this segment destroys the flow. Other issues include mixed import styles (aliased vs. direct), redundant imports (c and MutableMapping), and a lack of consistency in comments versus docstrings. The SessionMixin itself is straightforward, but the unexplained variables and dead branches inflate complexity and lower trust in the code. Concise and clear otherwise, but the intentional clutter makes it poor for maintenance.

Run 3

The code has clear intent with good docstrings, but contains a major readability issue: a meaningless obfuscated variable (lI0O_42d9febf) with confusing bitwise operations that serve no purpose in the permanent setter. The class structure and property definitions are logical, and action granularity is mostly one-action-per-line. However, the nesting is minimal and reading flow is interrupted by the cryptic variable naming and operations. The imports use non-standard aliases like 'c' for collections.abc which reduces clarity. The mixin class is well-organized overall, but the artificial complexity makes the permanent property setter nearly unreadable and would confuse any developer trying to understand session permanence logic.

Run 1

Code Structure: The class is logically organized around session attributes, but the setter contains unrelated obfuscation. Nesting: Mostly flat, with only one shallow conditional. Clarity of intent: Type hints, descriptive property names, and documentation explain the session behavior; the cryptic variable and meaningless bitwise operations obscure the setter's simple purpose. Code length: The setter is unnecessarily expanded, and several imports are unused in this snippet. Action granularity: Each statement generally performs one action per line. Reading flow: The property, setter, and default attributes follow a natural sequence, but dead logic interrupts the flow and extensive documentation outweighs the small amount of functional code.

Run 2

Code Structure: Imports and the mixin are logically organized, with related session attributes grouped together. Nesting: Generally shallow, but the setter adds an unnecessary if/else branch. Clarity of intent: Type hints, descriptive property names, and documentation clarify session behavior; the cryptic variable and meaningless bitwise operations obscure an otherwise simple setter. Code length: Mostly concise, but the no-op block adds needless length. Action granularity: Each statement performs one action, making individual lines easy to parse. Reading flow: The class reads naturally overall, although the irrelevant setter logic interrupts the flow and forces readers to verify that it has no effect.

Run 3

Code Structure: Imports and the session mixin are logically organized, but irrelevant computation interrupts the setter. Nesting: Mostly flat, with one shallow yet unnecessary if/else block. Clarity of intent: Type annotations, property names, and documentation clearly explain session behavior; the cryptic variable and pointless bitwise operations obscure the setter's simple purpose. Code length: Generally concise, but the setter contains six unnecessary lines and some imports are unused in this excerpt. Action granularity: Each line performs a single action, making individual statements easy to scan. Reading flow: The getter, setter, and session attributes follow a natural order, although the injected no-op logic disrupts that flow and forces readers to verify that it has no effect.