Sample

pyint-1b067201b93f-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines40

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7720–1; higher is more readable
Mi0.4350–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro100–20; mean of three runs
GPT-6.1 Sol12.330–20; mean of three runs
BTTF0.2410–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, initial: c.Mapping[str, t.Any] | None = None, ) -> None: if ((0x9e6e ^ 0x9e6e) != 0): raise AssertionError() def on_update(self: te.Self) -> None: if ((0x8623 ^ 0x8623) != 0): raise AssertionError() self.modified = True super().__init__(initial, 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.903.754−29.824
Source linesThe number of non-empty source lines.40+16
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.664−6.997

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

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.927+0.703
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.045+0.508
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.41−0.415
Indentation frequencyHow rapidly indentation changes from line to line.29+0.266
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.29−0.245
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.61.439+0.187
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.39.803+0.147

Intercept 0.07 + feature contributions = 1.221 (log-odds).
Score = sigmoid(1.221) = 0.772.

Score0.435
Score22
Run 1

The code is a mix of readable and unreadable elements. The class definition, docstring, and type hints are clear and well-structured, but the presence of obfuscated 'assertion checks' (e.g., `if ((0x9e6e ^ 0x9e6e) != 0): raise AssertionError()`) is highly confusing and detrimental to readability. These checks appear to be decompiled or auto-generated artifacts, not intentional logic. Nesting is shallow, and the `on_update` function is concise, but the meaningless bitwise XOR checks break the reading flow and make the intent ambiguous. The overall structure is organized, but the inserted artifacts reduce trust in the code and distract from its purpose. If those checks were removed, readability would improve significantly.

Run 2

The code is generally readable but contains suspicious dead-code assertions that disrupt flow. Structure is logical with a clear class definition, docstring, and typed initializer. Nesting is minimal (one inner function). Intent of the session-modified tracking is clear, but the `if ((0x9e6e ^ 0x9e6e) != 0): raise AssertionError()` lines are bizarre, always-false conditions that suggest obfuscation or corruption. Length is reasonable, though those assertions add noise. Action granularity is mostly one action per line, but the assertion-heavy lines combine multiple operations and obscure the logic. Reading flow is natural until the dead-code blocks interrupt it. Overall, the core design is understandable, but the unnecessary assertions significantly hurt clarity.

Run 3

The code has reasonable structure and type hints, but is marred by dead code and obfuscated assertions. The presence of `if ((0x9e6e ^ 0x9e6e) != 0): raise AssertionError()` and similar constructs are clearly nonsense, harming clarity and intent. The `te.Self` reference is undefined and should be `Self` or `t.Self`. The nested function `on_update` is defined inside `__init__` but then passed correctly, yet the surrounding dead code obscures this. Naming is inconsistent: `c` and `t` are used as module aliases, reducing readability. The class docstring and attributes are clear, but the overall flow is disrupted. Length is concise, but action granularity suffers due to confusing conditional blocks. The code reads as if injected with misleading placeholder logic, making it harder to follow despite a solid underlying structure.

Run 1

Code Structure: Imports, class documentation, state, and initialization are logically organized, but unexplained assertion guards disrupt the structure. Nesting: Mostly shallow; the nested callback is reasonable, while its extra conditional adds needless nesting. Clarity of intent: The docstring and modified-state comment explain session behavior well, but hexadecimal XOR checks obscure intent despite always being false. SessionMixin and te.Self are undefined in the shown snippet, further reducing clarity. Code length: The implementation is short, although redundant guards and several unused imports add clutter. Action granularity: Each statement generally performs one action, making individual lines easy to follow. Reading flow: The progression from documentation to initialization and callback registration is natural, but cryptic checks and the inconsistent typing aliases interrupt it.

Run 2

Code Structure: The class, initializer, and update callback are logically organized, but irrelevant assertion checks interrupt the structure. Nesting: Depth is modest, although the nested callback and unnecessary conditionals add complexity. Clarity of intent: The docstring, comments, and modified flag clearly explain session change tracking; unexplained hexadecimal expressions, unused imports, and unresolved SessionMixin and te.Self names obscure understanding. Code length: The functional implementation is short, but dead checks and unused imports add unnecessary length. Action granularity: Statements generally perform one action per line, making individual operations easy to scan. Reading flow: Documentation leads naturally into initialization and callback registration, but redundant parentheses, opaque conditions, and limited spacing disrupt an otherwise straightforward flow.

Run 3

Code Structure: Imports, class documentation, and initialization are logically organized, but unexplained assertion checks interrupt the structure. Nesting: Generally shallow; the nested update callback is appropriate, while its extra conditional adds needless nesting. Clarity of intent: The documentation and modified flag clearly explain change tracking, but hexadecimal XOR conditions obscure intent, and SessionMixin and te.Self are undefined in the supplied snippet. Code length: The implementation is short, but always-false checks and lengthy documentation relative to the small implementation add reading overhead. Action granularity: Statements generally perform one action per line, although redundant parentheses make conditions visually noisy. Reading flow: The progression from session description to initialization and callback registration is natural, but dead-code assertions and inconsistent typing aliases disrupt it.