Sample

pyint-c3d5b0857a14-SRC

Unmodified source class

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.330–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 highly readable due to its clear structure and minimal complexity. It uses modern Python features like `from __future__ import annotations` and the attrs library for clean class definition. The class has a single attribute and an explicit constructor that simply assigns the value, making the intent obvious. Nesting is flat, action granularity is one action per line, and the reading flow is logical. The only minor issue is the slight redundancy between `auto_detect=True` and the manual `__init__`, which could be simplified by relying fully on attrs' auto-generated constructor. This small redundancy slightly reduces conciseness but does not harm clarity.

Run 2

The code is concise and clearly structured. Imports are grouped logically, and the class definition is straightforward. The use of `@attrs.define(auto_detect=True)` followed by a custom `__init__` is slightly redundant because attrs already generates an initializer based on the field `x`; this may cause confusion about intent. The `__init__` body is flat and has one action per line. However, the unused imports (`copy`, `re`, `sys`, `Any`) add unnecessary length and reduce clarity about dependencies. Overall, the code is highly readable but could be improved by removing unused imports and explaining or simplifying the explicit constructor alongside attrs' auto-generation.

Run 3

The code is clean, well-structured, and easy to follow. It has a clear single class definition with straightforward imports and a simple attrs-based dataclass. The structure is logical, with imports grouped together, and the class definition is concise. Nesting is minimal—only one level for the class and method. The intent is clear: define an auto-detected attrs class with an explicit constructor. The code is concise with no unnecessary lines. However, there is a minor redundancy: using @attrs.define(auto_detect=True) alongside a manual __init__ is slightly contradictory and could confuse readers about whether attrs should generate the initializer, but this does not significantly harm readability. The reading flow is natural, from imports to class to method.

Run 1

Code Structure: The class and constructor are logically organized, although several unused imports add clutter. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The decorator explicitly enables automatic detection, and the constructor clearly initializes x; however, the generic class and attribute names provide little domain context. Code length: Very concise, though the unused imports and explicit constructor could be unnecessary depending on the intended attrs behavior. Action granularity: Each line performs one clear action. Reading flow: Natural top-to-bottom flow from imports to class definition and initialization, with minor spacing improvements possible around import groups and the class.

Run 2

Code Structure: Imports and a single class are logically organized, though four imports are unused and spacing between imports and the class could improve. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed field and straightforward assignment clearly describe a simple data container, but the generic class name and attrs auto-detection setting provide little context. Code length: Very concise, although the explicit initializer duplicates functionality attrs could generate. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom progression from imports to class definition to initialization, with minor distractions from unused imports and redundant boilerplate.

Run 3

Code Structure: Imports and the 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 field and simple assignment are clear, but the purpose of auto_detect=True alongside a custom initializer requires familiarity with attrs. Code length: Short, although several imports are unnecessary for this snippet. Action granularity: Each statement performs a single action. Reading flow: Straightforward from imports to class definition to initialization; additional spacing between import groups and the class would improve presentation.