Sample

pyint-5887de341b85-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines27

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Dorn0.8610–1; higher is more readable
Mi0.3590–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro9.670–20; mean of three runs
GPT-6.1 Sol100–20; mean of three runs
BTTF0.4750–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 NullSession(SecureCookieSession): """Class used to generate nicer error messages if sessions are not available. Will still allow read-only access to the empty session but fail on setting. """ def route(self, *step: t.Any, **amount: t.Any) -> t.NoReturn: raise RuntimeError( "The session is unavailable because no secret " "key was set. Set the secret_key on the " "application to something unique and secret." ) __setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail del _fail

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.618.286−20.403
Source linesThe number of non-empty source lines.27+10.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.515−6.772

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

Feature contributions

FeatureValueContribution
(log-odds)
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.034+0.614
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.80.071+0.487
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.82.893+0.154
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.28+0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.857−0.034

Intercept 0.07 + feature contributions = 1.827 (log-odds).
Score = sigmoid(1.827) = 0.861.

Score0.359
Score17
Run 1

Despite the docstring and small size, readability is severely hampered by vague and misleading naming (`route`, `step`, `amount` are unrelated to session behavior; `_fail` is used but never defined in the shown scope), which obscures the intended error-handling purpose. The class appears truncated or illogical because `NullSession` inherits from `SecureCookieSession` yet `_fail` is referenced and then deleted, creating confusion. Multiple assignments (`__setitem__ = __delitem__ = ...`) compress several actions into one line, reducing clarity. While nesting is minimal and imports are organized, the intent is ambiguous, and the code’s structure seems broken or incomplete. The snippet is concise but at the cost of explanatory clarity, making it difficult for a reader to follow the intended behavior.

Run 2

The code has some structure and a clear error message, but suffers from several readability issues. The class name NullSession suggests a null object pattern, yet it inherits from SecureCookieSession and defines a 'route' method that actually raises an error, creating confusing intent. The use of cryptic imports like 'import collections.abc as c' and 'import typing as t' reduces clarity. The method signature 'route(self, *step: t.Any, **amount: t.Any)' uses misleading parameter names that don't reflect their purpose. The line 'del _fail' is disorganized and suggests leftover debugging or code cleanup. While the code is concise and has minimal nesting, the ambiguous naming, confusing inheritance structure, and unclear method purpose significantly reduce readability.

Run 3

The code is moderately readable but has significant clarity issues. The class inherits from `SecureCookieSession`, which is not imported or defined in the snippet, making the code incomplete and ambiguous. The method `route` is poorly named—it appears to be a session operation but uses misleading parameter names (`step`, `amount`) and is actually an error-raising method. The alias assignment `__setitem__ = __delitem__ = clear = pop = popitem = update = setdefault = _fail` is compact but unclear because `_fail` is not defined in the visible code, and `del _fail` further obscures intent. Nesting is flat, and each line is relatively short, which helps readability, but the lack of clear naming and missing context lowers the score. The docstring explains the class purpose, but the method and attribute aliases do not align with standard session API expectations.

Run 1

Code Structure: The class and error-handling method are logically grouped, but the snippet includes many unused imports and references an undefined base class. Nesting: Minimal nesting makes it easy to scan. Clarity of intent: The docstring and exception clearly explain the read-only session behavior, but the method name 'route' and parameter names 'step' and 'amount' are misleading. The assignments reference '_fail', whereas the defined method is 'route', creating a confusing inconsistency. Code length: The implementation is compact, though unused imports add clutter. Action granularity: Most lines contain a single action, but the chained assignment combines seven method overrides, reducing immediate clarity. Reading flow: The progression from imports to documentation to the exception is natural, but the unexplained '_fail' assignment and deletion interrupt comprehension.

Run 2

Code Structure: Imports and a small session class provide a recognizable organization, but SecureCookieSession is not defined or imported in the snippet, and the method assignments reference undefined _fail rather than the declared route method. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and RuntimeError clearly explain read-only fallback behavior, but route, step, and amount are misleading names for a mutation-blocking method. Code length: The class is concise, although numerous unused imports add clutter. Action granularity: The chained assignment compresses seven method overrides onto one line, reducing readability; del _fail further obscures the implementation because _fail is undefined. Reading flow: The progression from imports to documentation to error handling is natural, but inconsistent naming and unresolved references interrupt comprehension and require readers to infer the intended implementation.

Run 3

Code Structure: Imports and a single class are logically organized, but numerous unused imports add clutter, and SecureCookieSession is not defined or imported in the snippet. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The docstring and error message clearly describe a read-only fallback session, but the method name route and parameter names step and amount obscure that intent. The method aliases reference undefined _fail rather than route, breaking the connection between the implementation and its intended use. Code length: The class is concise, although the imports are excessive for the shown functionality. Action granularity: Most statements perform one action, but chaining seven method assignments on one line compresses several behaviors and reduces readability. Reading flow: The class description, failure method, and mutation overrides form a natural sequence, but inconsistent naming and unresolved identifiers interrupt comprehension.