Sample

pyint-468aa2b55e8e-I05

Rewrite eligible decimal integer literals in hexadecimal notation

Matched original source

Lines12

Scores

MethodScoreScale
Posnett0.2770–1; higher is more readable
Dorn0.8530–1; higher is more readable
Mi0.7510–1; higher is more readable
LLOC9Logical lines; fewer is more readable
DeepSeek V4 Pro170–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.7820–1; higher is more readable

Views

Source code

from __future__ import annotations import re from typing import Any, Dict, List, Tuple import attr import attrs @attr.s(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.242.899−8.016
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.411−6.616
Source linesThe number of non-empty source lines.12+4.8

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

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.40.846+1.935
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.13+0.576
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.12−0.322
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.11.786−0.245
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.082+0.148

Intercept 0.07 + feature contributions = 1.755 (log-odds).
Score = sigmoid(1.755) = 0.853.

Score0.751
Score9
Run 1

The code is highly readable due to its simplicity and clean structure. It demonstrates a clear, focused purpose: defining a single attrs class with an explicit initializer. The structure is logical, with imports grouped, followed by the class definition. Nesting is minimal, with only a single method inside the class. Intent is unambiguous; the class name and attribute type hint make the purpose clear. Code length is concise, with no unnecessary logic. Each action (import statements, decorator, attribute, method, assignment) is on its own line, improving granularity. The reading flow is natural, from imports to class to method. Minor deductions are for the redundant `@attr.s(auto_detect=True)` decorator when a manual `__init__` is provided, which could confuse intent slightly, and the import of `re`, `Any`, `Dict`, `List`, `Tuple`, and `attrs` are unused. These unused imports slightly reduce clarity but do not significantly impact readability.

Run 2

The code is very short, clear, and logically organized. It imports only necessary modules and defines a single class with a simple constructor. There is no excessive nesting, and the intent is straightforward: a dataclass-like class with auto-detection enabled. Action granularity is appropriate, with one clear assignment in __init__. The reading flow is natural, from imports to class definition. The only minor issue is potential redundancy: using attr.s(auto_detect=True) along with a manual __init__ and explicit type annotation is unnecessary, since attrs auto-generates an __init__ by default. This adds slight confusion about why the manual constructor exists, but overall readability remains high.

Run 3

The code is clear and logically organized. It uses modern Python features and type hints, making intent obvious. The class has a single responsibility (demonstrating attr.s auto_detect), and actions are concise with no unnecessary nesting or verbosity. Readability is slightly reduced because the explicit __init__ method is redundant when using attr.s(auto_detect=True), and mixing 'attr' and 'attrs' imports could confuse readers. Overall, the code is easy to follow, flat, and concise.

Run 1

Code Structure: Imports and the class are logically organized, though several imports are unused and spacing between top-level elements could improve. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed field and constructor clearly express initialization, but the generic class name and auto_detect decorator provide limited context. Code length: Very concise, with minor clutter from unused imports. Action granularity: Each line performs a single clear action. Reading flow: Natural progression from imports to class definition to initialization, with only minor formatting distractions.

Run 2

Code Structure: Imports and the class are logically organized, though several imports are unused and importing both attr and attrs adds clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The typed x attribute and straightforward constructor are clear, but the generic class name and auto_detect decorator provide little context about the class's purpose. Code length: Very concise, with unnecessary imports accounting for most excess. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, although grouping imports and adding standard blank-line spacing before the class would improve presentation.

Run 3

Code Structure: Imports and a single class are logically organized, though several unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The typed attribute and initializer are clear, but the generic class name and auto_detect decorator require familiarity with attrs to understand their purpose. Code length: Short and concise, although unused imports are unnecessary. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom flow, with minor spacing improvements possible between import groups and before the class.