Sample

pyint-c2c9ead16622-I10

Deterministically remove some optional blank lines and bracketed line breaks

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 Pro16.670–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 clear and concise, with a logical top-to-bottom flow. It uses modern Python features like `from __future__ import annotations` and `attrs.define`, which improve readability. The `AutoDetect` class is simple, with a clear attribute and constructor. However, several points lower the score: the unused imports (`copy`, `re`, `sys`, `Any`) add noise and reduce clarity of intent. The `auto_detect=True` parameter is redundant because `attrs.define` already enables auto-detection by default, and manually defining `__init__` conflicts with attrs' purpose, potentially confusing readers. Nesting is flat, and each line performs one action, which is good. Overall, the structure is solid but the ambiguous imports and redundant configuration detract from readability.

Run 3

The code is highly readable. It has a clear, flat structure with a single class definition. Imports are logically grouped and standard. The use of `attrs.define` with `auto_detect=True` is concise, but the manual `__init__` is redundant and slightly contradictory — attrs can generate the initializer automatically. Nesting is minimal, intent is obvious (a simple data class with an integer field), and each action is on its own line. The reading flow is natural. Minor deductions: the unnecessary `__init__` adds length and ambiguity about whether attrs' auto-detection is being overridden, and the `copy`, `re`, `sys`, and `Any` imports are unused, slightly reducing clarity of intent. Overall, the code is almost exemplary for a small class definition.

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 attribute and explicit initializer clearly show how x is stored, but the purpose of auto_detect=True requires familiarity with attrs. Code length: Very concise, although unused imports add clutter. Action granularity: Each statement performs a single action. Reading flow: Natural top-to-bottom flow; an additional blank line before the decorated class would improve conventional formatting.

Run 2

Code Structure: Imports and a single class are logically organized, though unused imports (copy, re, sys, Any) add clutter. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed attribute and assignment are clear, but the generic class name and unexplained auto_detect option leave the broader purpose unclear. Code length: Short, although the explicit initializer duplicates functionality attrs can generate. Action granularity: Each line performs one action. Reading flow: Straightforward from imports to declaration to initialization; additional spacing between import groups and before the class would improve readability.

Run 3

Code Structure: Imports and the class are logically organized, although copy, re, sys, and Any are unused. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed x field and straightforward assignment are clear, but combining attrs auto-detection with a custom initializer requires some library knowledge. Code length: Very concise, though the unused imports add clutter and the explicit initializer could be unnecessary if attrs-generated initialization is intended. Action granularity: Each statement performs one action. Reading flow: Natural and easy to follow; additional blank lines between import groups and before the class would improve formatting.