Sample

pyint-778c2c6129f0-I11

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

Matched original source

Lines24

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7590–1; higher is more readable
Mi0.6820–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.1790–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 TagBytes(JSONTag): __slots__ = () key = " b" def check(self, value: t.Any) -> bool: return isinstance(value, bytes) def to_json(self, value: t.Any) -> t.Any: return b64encode(value).decode("ascii") def to_python(self, value: t.Any) -> t.Any: return b64decode(value)

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.742.8−24.512
Source linesThe number of non-empty source lines.24+9.6
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.762−7.142

Intercept 8.87 + feature contributions = -13.185 (log-odds).
Score = sigmoid(-13.185) = 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.46.92+1.678
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.08+0.165
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.25+0.151
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.24−0.13
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.23.708−0.078

Intercept 0.07 + feature contributions = 1.145 (log-odds).
Score = sigmoid(1.145) = 0.759.

Score0.682
Score20
Run 1

The code is clean and readable. It follows a logical structure with clear imports and a focused class definition. Nesting is minimal and intent is unambiguous for each method. The use of type hints, __slots__, and a class-level key attribute demonstrates good design and reduces ambiguity. Each method performs a single action, and the flow is natural (check → serialize → deserialize). Although it omits the parent class definition, the code is concise and easy to follow.

Run 2

The code is well-structured and readable. It follows a clear logical organization with grouped imports, a single class definition, and simple methods. The nesting is flat, and each method has a clear, single responsibility. Intent is explicit through method names and the use of type hints, which enhance clarity. The code is concise without unnecessary verbosity, and each action is on its own line, contributing to a clean reading flow. Minor deductions include the lack of a docstring for the class and methods, which would improve understanding of the tag's purpose, and the slightly cryptic key assignment. Some imports are split across multiple lines, which is stylistic but consistent. Overall, it is a clean, maintainable piece of code that is easy to follow.

Run 3

The code is well-structured and highly readable. It logically groups imports, follows a single class purpose, and uses flat, minimal nesting. Each method has a clear, singular responsibility. The use of type hints and concise conditional expressions enhances clarity. The class and method names are descriptive. The code is compact without being terse, maintaining a natural reading flow from definition to implementation.

Run 1

Code Structure: The class is logically organized into type checking, serialization, and deserialization methods. Nesting: There is no unnecessary nesting; each method is a straightforward return. Clarity of intent: Method names and base64 operations clearly indicate byte conversion, though the unexplained key " b" and undefined JSONTag base class reduce standalone clarity. Code length: The implementation is concise, but several imports are unused in the provided snippet. Action granularity: Each line performs one focused action; the encode/decode chain is short and readable. Reading flow: Imports, class attributes, and methods follow a natural sequence, although a blank line between imports and the class would improve visual separation.

Run 2

Code Structure: Imports and a compact class are logically organized, with separate methods for type checking, serialization, and deserialization. Nesting: There is no nested control flow, making the code easy to scan. Clarity of intent: TagBytes, check, to_json, and to_python communicate their roles clearly; Base64 conversion is straightforward. However, JSONTag is not defined or imported in the snippet, and the key " b" lacks explanation. Code length: The class is concise, though several imports are unused in the displayed code and add clutter. Action granularity: Each statement occupies its own line; the encode-and-decode chain remains simple and readable. Reading flow: The methods follow a natural check-to-serialization-to-deserialization sequence. Limited spacing between import groups and the class slightly reduces visual organization.

Run 3

Code Structure: A small, cohesive class cleanly separates type checking, serialization, and deserialization, though several imports are unused and JSONTag is not defined in the snippet. Nesting: Methods are flat with no nested control flow. Clarity of intent: TagBytes and the method names clearly convey byte serialization using Base64; the opaque key " b" and unexplained __slots__ slightly reduce clarity. Code length: The implementation is concise, but unused imports add clutter. Action granularity: Each method contains a single return statement; the encode-and-decode chain is compact and easy to follow. Reading flow: Imports followed by class metadata and three straightforward methods provide a natural progression, although more spacing between imports and the class would improve presentation.