Sample

pyint-6433180d8bba-I01

Remove comments and docstrings

Matched original source

Lines30

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7480–1; higher is more readable
Mi0.6610–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro80–20; mean of three runs
GPT-6.1 Sol14.330–20; mean of three runs
BTTF0.40–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): modified = False def __init__( self, initial: c.Mapping[str, t.Any] | None = None, ) -> None: def on_update(self: te.Self) -> None: 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.692.036−22.837
Source linesThe number of non-empty source lines.30+12
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.589−6.884

Intercept 8.87 + feature contributions = -8.851 (log-odds).
Score = sigmoid(-8.851) = 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.65.935+0.872
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.305
Indentation frequencyHow rapidly indentation changes from line to line.30+0.301
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.31−0.061
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.29.896+0.008

Intercept 0.07 + feature contributions = 1.088 (log-odds).
Score = sigmoid(1.088) = 0.748.

Score0.661
Score17
Run 1

The code has reasonable structure but contains several readability issues. The class definition is clean, and type hints are used consistently. However, there is excessive whitespace with multiple blank lines between the class declaration and first attribute, which disrupts reading flow. The import of 'MutableMapping' is unused, suggesting dead code. The 'on_update' function references 'te.Self' without importing or aliasing the 'te' module, making it ambiguous and potentially broken. The nesting is minimal, which is good, but the intent of the 'modified' flag could be clearer with a docstring or comment. The overall code is concise but missing context for how this session integrates with the broader application. The blank lines and unused imports make it feel disorganized. Action granularity is acceptable—one action per line. Reading flow is natural except for the whitespace issues and the undefined 'te' reference, which forces the reader to pause and question correctness.

Run 2

The code imports many unused modules (hashlib, datetime, timezone, BadSignature, URLSafeTimedSerializer, TaggedJSONSerializer) which creates ambiguity about intent. The class definition includes excessive blank lines mid-class (six empty lines between the class header and the first member), which disrupts reading flow and violates typical style conventions. The __init__ method defines a nested callback function on_update that references 'te.Self' — a name that is neither imported nor defined, causing both a runtime error and reader confusion. The trailing comma in super().__init__(initial, on_update) is syntactically valid but unnecessary. The code attempts to use modern type hints (| union syntax, from __future__ import annotations) which is good, but the execution is undermined by the unused imports, undefined names, and poor formatting. The overall structure is minimal, but the clutter and broken references make it hard to read and understand the actual purpose.

Run 3

The code has mixed readability. The class definition is clear with type hints and proper inheritance, but there are several issues. Multiple blank lines (7+) break natural reading flow and waste vertical space. The 'modified' flag lacks documentation or context about its purpose. The 'on_update' callback is nested inside __init__, uses a forward reference 'te.Self' without importing 'te', and has misleading parameter naming ('self' shadows outer scope). Missing imports for SessionMixin and typing_extensions add ambiguity. The code structure is minimal but incomplete, making intent unclear. Action granularity is acceptable with one main operation per line, but the nesting of the callback closure increases complexity. Code length is concise but at the cost of clarity due to missing context and incomplete imports. Overall, the code requires fixes and documentation to be considered readable.

Run 1

Code Structure: Imports followed by a class and constructor provide a logical organization, but excessive blank lines and several unused imports add clutter. Nesting: Shallow nesting, with only a small callback inside the constructor, is easy to follow. Clarity of intent: The callback clearly marks the session as modified when updated, though SessionMixin and te.Self are undefined in the provided snippet, and abbreviated aliases reduce clarity. Code length: The implementation is concise, but its presentation is unnecessarily stretched by whitespace and unrelated imports. Action granularity: Each statement performs one clear action, with no compressed multi-action lines. Reading flow: The constructor flows naturally from defining the update callback to registering it with the superclass, but the empty space and unresolved names interrupt otherwise straightforward reading.

Run 2

Code Structure: Imports, class state, and initialization are logically organized, although excessive blank lines weaken presentation. Nesting: Shallow nesting is appropriate; the small callback inside the constructor is easy to follow. Clarity of intent: The callback clearly marks the session as modified, but SessionMixin and te.Self are undefined in the provided snippet, and several unused imports distract from its purpose. Code length: The implementation is concise, but redundant whitespace and unused imports add unnecessary length. Action granularity: Each statement performs a single action, making operations easy to distinguish. Reading flow: The progression from imports to class configuration to initialization is natural, though whitespace gaps and unexplained dependencies interrupt it.

Run 3

Code Structure: Imports and the class are logically arranged, but excessive blank lines interrupt organization, and several imports are unused in this snippet. Nesting: Shallow overall; the nested callback is appropriate and easy to follow. Clarity of intent: Class and callback names clearly suggest session modification tracking, but SessionMixin and te.Self are not defined or imported in the snippet, and abbreviated aliases reduce immediate clarity. Code length: The implementation is concise, though unnecessary whitespace and imports add clutter. Action granularity: Each statement performs one clear action. Reading flow: Initialization proceeds naturally from callback definition to superclass initialization, but the large whitespace gap and unresolved names distract readers.