Sample

pyint-92aa87136777-I10

Deterministically remove some optional blank lines and bracketed line breaks

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 Sol17.670–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 highly readable due to its clean structure and clarity. Imports are organized logically, with standard library imports first, followed by third-party packages. The class definition is concise and uses a clear, conventional pattern for attrs integration. There is minimal nesting, and actions are well-separated per line. The intent is straightforward: define a simple data class with an explicit constructor. Redundancy in declaring both the field and the custom __init__ slightly reduces brevity, but the code remains easy to understand. Overall, the flow is natural and unobstructed.

Run 3

The code is short and mostly clear, but it has structural and clarity issues that lower its readability. The class uses `@attr.s(auto_detect=True)` from the `attr` library while also importing `attrs`, creating an unnecessary dual-import and potential confusion about which library is intended. The explicit `__init__` method is redundant with `attr.s` auto-generation, making the code longer than necessary. The unused imports (`re`, `Any`, `Dict`, `List`, `Tuple`) clutter the top and suggest incomplete cleanup. Nesting is flat and action granularity is fine. Reading flow is okay, but the mixed use of two similar libraries and dead imports obscure intent. Overall, it is readable but could be improved by removing unused imports, dropping the redundant constructor, and choosing either `attr` or `attrs` consistently.

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 attribute and constructor clearly show how x is initialized, but the generic class name and unexplained auto_detect setting provide little context. Code length: Very concise, with unnecessary imports adding minor clutter. Action granularity: Each statement performs one action. Reading flow: Natural progression from imports to decorator, class, and initialization; importing both attr and attrs unnecessarily introduces slight confusion.

Run 2

Code Structure: Imports and the class are logically organized, though several imports are unused and add clutter. Nesting: Only the necessary class and method nesting is present. Clarity of intent: The class clearly stores an integer, but the generic class name and decorator's auto-detection behavior offer limited context. Code length: Very concise, although unnecessary imports reduce efficiency. Action granularity: Each statement performs one action, with no compressed compound statements. Reading flow: Straightforward from imports to decorator, class, and initialization; additional spacing between import groups and the class would improve presentation.

Run 3

Code Structure: Imports and the class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The class clearly stores an integer, but the generic name and auto_detect decorator do not explain its broader purpose. Code length: Very concise, although unused imports add clutter. Action granularity: Each line performs a single action. Reading flow: Natural top-to-bottom flow, with minor spacing improvements needed between import groups and before the class.