Sample

pyint-2f2229d34ea8-I13

Lower every eligible synchronous for loop to a while loop

Matched original source

Lines22

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6680–1; higher is more readable
Mi0.5690–1; higher is more readable
LLOC18Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.4530–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 PassList(JSONTag): __slots__ = () def check(self, value: t.Any) -> bool: return isinstance(value, list) def to_json(self, value: t.Any) -> t.Any: return [self.serializer.tag(item) for item in value] 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.660.331−21.791
Source linesThe number of non-empty source lines.22+8.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.71−7.065

Intercept 8.87 + feature contributions = -11.186 (log-odds).
Score = sigmoid(-11.186) = 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.59.957+1.126
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.071+0.253
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.23+0.222
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.21.754−0.106
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.22−0.084
Indentation frequencyHow rapidly indentation changes from line to line.22+0.024

Intercept 0.07 + feature contributions = 0.7 (log-odds).
Score = sigmoid(0.7) = 0.668.

Score0.569
Score18
Run 1

The code is highly readable with a clear, logical structure. The class PassList inherits from JSONTag and implements its interface cleanly, with each method performing a distinct action. Nesting is minimal, and the code is concise, avoiding unnecessary length. Intent is evident: the class handles serialization of list types by tagging each item. Action granularity is appropriate, with one clear operation per line, and the reading flow follows a natural sequence from type checking to serialization. Minor deductions are for the redundant tag = to_json assignment, which is slightly ambiguous without context, but overall the code is well-organized and easy to follow.

Run 2

The code is generally clear and well-organized, with logical imports and a concise class definition. Structure is clean, and nesting is minimal. Intent is fairly clear: it serializes list values to JSON using a serializer's tagging mechanism. However, readability is slightly reduced by a few issues: 'tag = to_json' is a bit ambiguous without context, and 'check' and 'to_json' lack docstrings explaining their roles. Some imports (e.g., datetime, UUID, Markup, http_date, parse_date, loads, b64decode) appear unused here, which adds noise. Action granularity and reading flow are good, but the unused imports and minor ambiguity keep the score from being higher.

Run 3

The code is highly readable with a clear, logical structure. It uses modular imports, a focused class definition with a single responsibility, and flat nesting. Each method is short and expresses a single action, making intent obvious. The `tag = to_json` alias is a minor point of ambiguity—its purpose isn't immediately apparent without additional context—but overall naming is descriptive and the flow is natural. The code length is concise, with no unnecessary complexity or repetition.

Run 1

Code Structure: The class is logically organized into a type check, conversion method, and alias, though numerous unused imports add clutter. Nesting: Methods are flat, with a simple list comprehension and no deeply nested control flow. Clarity of intent: Method names and the list check clearly suggest list serialization, but JSONTag and self.serializer are not defined in the snippet, and tag = to_json requires familiarity with method aliasing. Code length: The implementation is concise, although the import section is disproportionately long. Action granularity: Each line performs one clear action; the comprehension compactly expresses a single transformation. Reading flow: The class reads naturally from validation to conversion, but missing surrounding context and unnecessary imports slightly interrupt comprehension.

Run 2

Code Structure: The class is logically organized into type checking and serialization methods, though numerous unused imports distract from the small implementation. Nesting: Methods are flat, with only a straightforward list comprehension. Clarity of intent: Method names and isinstance make the purpose clear, but JSONTag is not defined or imported in the snippet, and the tag alias and serializer dependency require external context. Code length: The class is concise, although the import section is disproportionately long. Action granularity: Each statement performs a single clear action; the comprehension compactly expresses element-wise tagging. Reading flow: Imports followed by a class and short methods provide a natural progression, but minimal spacing between sections and the unexplained alias slightly reduce readability.

Run 3

Code Structure: A small class cleanly groups type checking and serialization, though numerous unused imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Minimal nesting and a straightforward list comprehension make the code easy to scan. Clarity of intent: Method names and the isinstance check clearly convey list handling, but PassList and the tag alias assume familiarity with the surrounding serialization framework. Code length: The class is concise; the import section is disproportionately long for the functionality shown. Action granularity: Each statement performs a single clear action, with the comprehension compactly expressing element-wise tagging. Reading flow: Methods follow a natural check-then-convert sequence, although import clutter and limited spacing between imports and the class slightly interrupt the flow.