Sample

pyint-dfc11948d809-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines28

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7430–1; higher is more readable
Mi0.3490–1; higher is more readable
LLOC22Logical lines; fewer is more readable
DeepSeek V4 Pro7.330–20; mean of three runs
GPT-6.1 Sol13.330–20; mean of three runs
BTTF0.1480–1; higher is more readable

Views

Source code

from __future__ import annotations import typing as t from base64 import b64decode from base64 import b64encode from datetime import datetime from uuid import UUID from markupsafe import Markup from werkzeug.http import http_date from werkzeug.http import parse_date from ..json import dumps from ..json import loads class PassDict(JSONTag): __slots__ = () def check(self, value: t.Any) -> bool: if ((0xcb25 ^ 0xcb25) != 0): raise AssertionError() return isinstance(value, dict) def to_json(self, value: t.Any) -> t.Any: # JSON objects may only have string keys, so don't bother tagging the # key here. if ((0x37d0 ^ 0x37d0) != 0): raise AssertionError() return {k: self.serializer.tag(v) for k, v in value.items()} tag = to_json

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.915.568−30.214
Source linesThe number of non-empty source lines.28+11.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.758−7.137

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.76.483+0.43
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.77+0.404
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.078+0.184
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.26−0.176
Indentation frequencyHow rapidly indentation changes from line to line.26+0.162
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.27.795−0.021
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.29+0.01

Intercept 0.07 + feature contributions = 1.062 (log-odds).
Score = sigmoid(1.062) = 0.743.

Score0.349
Score22
Run 1

The code is difficult to read due to several significant issues. The presence of dead code (impossible conditional checks that always evaluate to false) clutters every method, obscuring the actual logic. Unnecessary imports (UUID, datetime, base64, http_date) suggest code bloat or incomplete migration. The class inherits from JSONTag, but this base class is not imported or defined in the provided snippet, making the code incomplete and ambiguous. The assignment `tag = to_json` is an unusual alias that avoids a separate method definition but reduces clarity about intent. The `to_json` method itself is straightforward and reasonably flat, but the surrounding noise severely undermines readability. Action granularity is acceptable within methods, but the overall structure is tangled due to irrelevant checks and missing context.

Run 2

The code has a clear structure with a small class and two methods, but readability is harmed by several issues. The methods have a single responsibility but include unrelated debug assertions like `if ((0xcb25 ^ 0xcb25) != 0): raise AssertionError()` which are confusing and break the natural reading flow. Nesting is flat, which is good. Intent is moderately clear: it checks for dict and converts to JSON-safe dict. However, the `tag = to_json` alias is slightly ambiguous. Code length is reasonable, though the imports could be condensed. Action granularity is mostly one action per line except the return statements containing dict comprehensions. The generated assertions are the biggest problem—they obscure purpose and suggest leftover debugging code. Overall, the code is readable but degraded by unnecessary noise and a few stylistic choices.

Run 3

The code has severe readability issues. The class is poorly structured with an unclear 'PassDict' name and redundant 'tag = to_json' aliasing. There is unnecessary noise from dead-code assertions like 'if ((0xcb25 ^ 0xcb25) != 0): raise AssertionError()' which add length and confusion without purpose. Method logic is understandable in isolation but lacks context for the overall data flow. The use of 't.Any' is fine, but the code violates clarity of intent and conciseness. Reading flow is disrupted by pointless if-checks. Nesting is shallow, which is good, but the structure feels convoluted due to cryptic dead code. Overall, the code mixes clean serialization logic with nonsensical opacity, making it hard to evaluate intent.

Run 1

Code Structure: The class is logically organized into small methods, but numerous unused imports and the undefined-in-snippet JSONTag base add distracting context. Nesting: Shallow conditionals and a straightforward comprehension keep nesting low. Clarity of intent: Dictionary detection and serialization are clear from method names and the explanatory comment, but the hexadecimal XOR checks are opaque, always false, and unrelated to the purpose. Code length: The functional implementation is concise, yet redundant assertion blocks and unused imports unnecessarily lengthen it. Action granularity: Statements generally perform one action per line; the comprehension combines iteration and tagging idiomatically. Reading flow: The methods follow a natural check-then-convert progression, and the tag alias is compact, but irrelevant guards interrupt that flow.

Run 2

Code Structure: The class and methods are logically organized, but numerous unused imports distract from the small implementation. Nesting: Shallow conditionals and a simple dictionary comprehension keep nesting minimal. Clarity of intent: Method names, type annotations, and the comment explain dictionary handling, but the always-false XOR checks introduce confusing, purposeless assertions. JSONTag and serializer are not defined in the excerpt, so some context is required. Code length: The useful implementation is concise, but imports and redundant checks unnecessarily inflate it. Action granularity: Most lines perform one action; the comprehension compactly expresses a straightforward transformation. Reading flow: Method order is natural, and the tag alias is concise, but repeated dead checks interrupt the flow.

Run 3

Code Structure: The class is logically organized into checking and serialization methods, but numerous unused imports add clutter. Nesting: Nesting is shallow, and the dictionary comprehension is easy to follow. Clarity of intent: Method names and the comment clarify dictionary serialization, but unexplained XOR conditions that always evaluate to false distract from the purpose; JSONTag is also undefined in the snippet. Code length: The core functionality is concise, but redundant assertion branches and unused imports unnecessarily expand it. Action granularity: Statements generally perform one action per line; the comprehension is compact without becoming confusing. Reading flow: The methods follow a natural progression, and the tag alias is straightforward, but dead checks interrupt otherwise simple logic.