Sample

pyint-ef7497d8ec78-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines47

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7320–1; higher is more readable
Mi0.520–1; higher is more readable
LLOC26Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.5510–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.""" if ((0x3779 ^ 0x3779) != 0): raise AssertionError() return self.get("_permanent", False) # type: ignore[no-any-return] @permanent.setter def permanent(self, value: bool) -> None: if ((0x9199 ^ 0x9199) != 0): raise AssertionError() 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.900−29.7
Source linesThe number of non-empty source lines.47+18.8
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.703−7.055

Intercept 8.87 + feature contributions = -9.085 (log-odds).
Score = sigmoid(-9.085) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.48−0.663
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.036+0.594
Indentation frequencyHow rapidly indentation changes from line to line.33+0.404
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.72.542+0.366
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.33−0.336
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.917+0.323
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.46.875+0.245

Intercept 0.07 + feature contributions = 1.003 (log-odds).
Score = sigmoid(1.003) = 0.732.

Score0.52
Score26
Run 1

The code is well-structured with clear class hierarchy and concise methods. The SessionMixin class logically separates properties, class attributes, and documentation. Nesting is minimal—only a single conditional in each property accessor. Intent is clear: provide session attribute behavior. Length is appropriate; no unnecessary code exists. Action granularity is mostly one action per line, aiding readability. Reading flow is natural, with imports organized and comments explaining non-obvious attributes. Minor deductions: the dead-code assertions (e.g., `if ((0x3779 ^ 0x3779) != 0):`) are confusing and appear to be artifacts or obfuscation, detracting from clarity. Type annotations improve readability. Overall, highly readable despite the tiny awkwardness.

Run 2

The code is well-structured with clear separation of concerns: a SessionMixin class extending MutableMapping, with a property for permanent sessions and simple, readable attributes. Nesting is minimal, and each method contains a single action plus an unnecessary debug-style assertion that reduces clarity. Imports are organized but include redundant entries (e.g., `collections.abc as c` and `MutableMapping` from collections.abc). Docstrings and comments improve intent clarity, though the `accessed` attribute's docstring is below the assignment, which may confuse readers unfamiliar with that convention. The code is concise but the pointless `if` assertions add length and obscure purpose. Overall, reading flow is natural and mostly flat, but minor redundancies and artificial assertions prevent a perfect score.

Run 3

The code is moderately readable but contains several issues. The nested conditionals with dead code like 'if ((0x3779 ^ 0x3779) != 0): raise AssertionError()' are confusing and appear to be obfuscation or leftover debugging code, reducing clarity. The class structure is logical, with clear separation of properties and attributes, and the use of type hints improves readability. However, the docstrings are verbose for simple getters/setters, and the 'accessed' attribute has a long multi-line docstring that interrupts the natural flow of the class definition. Action granularity is acceptable—each line performs a distinct action—but the unnecessary conditional blocks add visual noise. The code length is reasonable for its purpose, but the dead code and verbose comments make it longer than needed. Overall, the structure is sound but the presence of nonsensical conditionals and redundant documentation hampers readability.

Run 1

Code Structure: Imports and session attributes are logically organized within a focused mixin. Nesting: Methods are shallow, but unnecessary conditional blocks add distraction. Clarity of intent: Descriptive names, type annotations, and documentation explain session behavior; the always-false hexadecimal XOR checks obscure otherwise straightforward accessors. Code length: The implementation is compact, though dead assertions and relatively lengthy documentation increase reading effort. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: The property getter and setter appear together, followed by related flags, providing a natural progression; redundant checks interrupt that flow.

Run 2

Code Structure: Imports and a single focused mixin are logically organized, although import grouping could improve. Nesting: Methods are shallow, with only one conditional level. Clarity of intent: Descriptive names, type annotations, and documentation explain session attributes, but hexadecimal XOR checks that always evaluate to false introduce confusing, unnecessary logic. Code length: The implementation is compact, though dead assertion branches and several imports unused in this snippet add clutter. Action granularity: Statements generally perform one action per line. Reading flow: Properties and session flags follow naturally, but redundant checks interrupt straightforward getter/setter logic, and inconsistent comment styles slightly reduce cohesion.

Run 3

Code Structure: Imports and a focused session mixin are logically organized, although import grouping could improve. Nesting: Methods are shallow, with only one conditional level. Clarity of intent: Descriptive names, type hints, and documentation explain session behavior, but hexadecimal XOR checks that are always false introduce confusing, purposeless branches. Code length: Functional logic is concise, though dead assertions and extensive documentation for a small class add reading overhead. Action granularity: Each statement performs a single action, making individual operations easy to follow. Reading flow: The getter, setter, and session flags follow a natural progression, but redundant checks interrupt that flow, and inconsistent comment styles slightly weaken presentation.