Sample

pyint-932b332fbe23-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines13

Scores

MethodScoreScale
Posnett0.5690–1; higher is more readable
Dorn0.9010–1; higher is more readable
Mi0.6990–1; higher is more readable
LLOC10Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol17.670–20; mean of three runs
BTTF0.8110–1; higher is more readable

Views

Source code

from __future__ import annotations import copy import re import sys from typing import Any import attrs @attrs.define(auto_detect=True) class AutoDetect: x: int def __init__(self, x: int): self.x = x

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.218.725−7.218
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.384−6.576
Source linesThe number of non-empty source lines.13+5.2

Intercept 8.87 + feature contributions = 0.277 (log-odds).
Score = sigmoid(0.277) = 0.569.

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.33.429+2.249
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.14+0.541
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Indentation frequencyHow rapidly indentation changes from line to line.13−0.287
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.068+0.278
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.12.686−0.233

Intercept 0.07 + feature contributions = 2.212 (log-odds).
Score = sigmoid(2.212) = 0.901.

Score0.699
Score10
Run 1

The code is very readable with clear structure and intent. It uses modern Python features (from __future__ import annotations, attrs library) and defines a simple class with a single attribute. Each import is on a separate line, the class definition is clean, and the __init__ method clearly assigns the attribute. One minor point: the explicit __init__ method is redundant if auto_detect=True is used, which could be slightly confusing. However, overall the code is concise, flat, and easy to follow.

Run 2

The code is generally readable and concise. It has a clear, flat structure with a single class definition and one method, avoiding unnecessary nesting. Imports are organized and standard for the context. The intent is clear: define a simple attrs class with auto-detection enabled. However, the explicit `__init__` method is redundant because `attrs.define` with `auto_detect=True` already generates an initializer, which may confuse readers unfamiliar with attrs behavior. This adds minor ambiguity about why the manual constructor exists. Action granularity is good—one instruction per line. Reading flow is natural. The code is short and focused, but the redundant constructor slightly reduces clarity for someone not deeply familiar with the attrs library.

Run 3

The code is highly readable due to its clear structure, minimal nesting, and concise length. It defines a single attrs-based class with an explicit constructor, making the intent obvious. The imports are grouped logically, and the action granularity is appropriate—one operation per line. The reading flow is natural, progressing from imports to class definition. Minor deductions could be made for the slightly redundant explicit __init__ given attrs auto-detection, and the unused imports (copy, re, sys, Any), which slightly detract from clarity. Overall, it is well-organized, flat, and easy to follow.

Run 1

Code Structure: Imports and the class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The typed field and constructor are clear, but the generic names and interaction between auto_detect=True and the explicit constructor require familiarity with attrs. Code length: Short overall, though unused imports and a constructor that duplicates typical attrs-generated initialization add clutter. Action granularity: Each line performs one clear action. Reading flow: Natural top-to-bottom flow, with minor spacing issues between imports and the class.

Run 2

Code Structure: Imports and the class are logically organized, though several imports are unused. Nesting: Only the minimal class-and-method nesting is present. Clarity of intent: The typed attribute and explicit initializer are clear, but the generic names and unexplained auto_detect setting provide little context. Code length: Very concise, although the explicit initializer could be redundant depending on the decorator's intended use. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, with minor formatting improvements possible through import grouping and an additional blank line before the class.

Run 3

Code Structure: The class is logically organized, although several unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The annotated field and explicit initializer clearly show how the instance stores its value, though the generic class and field names provide little domain context. Code length: Very concise, but the initializer appears redundant with attrs-generated initialization. Action granularity: Each line performs a single action. Reading flow: Imports, decorator, class declaration, field, and initializer follow a natural sequence; additional spacing between import groups and the class would improve presentation.