Sample

pyint-e43614012f8d-I11

Split eligible integer literals into pairs of short-named intermediate variables

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 Pro14.670–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 readable, with good type hints and imports. The PassList class is logically structured and concise. However, several issues impact readability: unused imports (b64decode, b64encode, datetime, UUID, Markup, http_date, parse_date, dumps, loads) add noise and suggest incomplete refactoring. The check() method is straightforward, but to_json() and tag have redundant duplication—tag simply aliases to_json, which may confuse readers about why both exist. Action granularity is good within to_json(), but the class lacks any explanatory docstrings or comments to clarify intent. The reading flow is mostly natural, but the unused imports and unexplained alias disrupt it. The dependency on JSONTag and serializer is implicit, making the code harder to understand in isolation. Overall, the code is readable but could be significantly improved by removing dead imports and clarifying the relationship between to_json and tag.

Run 3

The code is generally structured and concise, with clear imports and a small class. However, several issues reduce readability: the class inherits from JSONTag without definition or import (ambiguous context), 'PassList' and method names suggest intent but are not self-explanatory without surrounding code. The assignment 'tag = to_json' at the end is confusing—why is it needed? It obscures whether 'tag' is a method or alias. Action granularity is mostly fine (one action per line in to_json), but the list comprehension packs serialization into one line, reducing clarity. Nesting is minimal, which is good. Some imports (b64decode, b64encode, datetime, UUID, Markup, http_date, parse_date) appear unused, adding unnecessary length and noise. Overall, readable for someone familiar with the codebase, but not immediately clear in isolation.

Run 1

Code Structure: The class is logically organized into type checking and serialization, although numerous unused imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Methods are flat, with no deeply nested control flow. Clarity of intent: Method names and the list comprehension clearly communicate list detection and item tagging, but the PassList name and tag alias require some surrounding context. Code length: The implementation is concise; the import block is disproportionately long for the shown functionality. Action granularity: Each line performs a single clear action, with a straightforward comprehension. Reading flow: The class reads naturally from checking to conversion, though limited spacing around imports and the class slightly reduces visual separation.

Run 2

Code Structure: The class logically groups type checking and list serialization, although numerous unused imports add clutter and JSONTag is not defined or imported in the snippet. Nesting: Minimal nesting makes the methods easy to follow. Clarity of intent: Method names, type hints, and the straightforward comprehension communicate the purpose; the class name PassList and tag alias are less self-explanatory without surrounding context. Code length: The implementation is concise, but the imports are disproportionate to the functionality shown. Action granularity: Each statement performs one clear action. Reading flow: The progression from checking a value to serializing its items is natural, though import grouping and additional spacing before the class would improve presentation.

Run 3

Code Structure: The class is logically organized into type checking and serialization methods, but numerous unused imports add clutter, and JSONTag is not defined or imported in the snippet. Nesting: The code is flat, with no deeply nested logic. Clarity of intent: Method names and the list comprehension clearly convey list detection and element tagging; the class name and tag alias are less self-explanatory without context. Code length: The class is concise, although the import block is disproportionately long for the shown functionality. Action granularity: Each statement performs a single clear action. Reading flow: The methods are easy to follow, but import clutter and limited spacing between imports and the class slightly interrupt the flow.