Sample

pyint-78c589572b16-I01

Remove comments and docstrings

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 Pro17.330–20; mean of three runs
GPT-6.1 Sol180–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. It has a clear, simple structure: a single class definition with one attribute and a minimal constructor. Nesting is effectively flat, with only the class body containing a method. The intent is unambiguous—defining a straightforward data class using `attrs` with auto-detection enabled. The code is concise, avoiding unnecessary boilerplate. Each action is on its own line, promoting clarity. The reading flow is natural: imports, class declaration, attribute type hint, and a simple initializer. The only minor redundancy is the explicit `__init__` method, which `attrs` could generate automatically if `auto_attribs` were used instead of `auto_detect`, but this doesn't significantly hinder readability.

Run 2

The code is concise and logically structured with clear intent. It defines a single attrs-based class with an explicit constructor. The nesting is flat, each line performs a single action, and the reading flow is natural. Minor deductions: the redundant __init__ duplicates what attrs would auto-generate, and unused imports slightly clutter the file, but overall readability remains high.

Run 3

The code is clean and well-structured. It imports only necessary modules, defines one class with a simple attribute, and uses the attrs decorator in a standard way. The `auto_detect=True` parameter is a bit unusual but acceptable. The explicit `__init__` method is redundant when using `@attrs.define`, which slightly hurts conciseness. Indentation is flat, each action is on one line, and the intent is clear. Overall, highly readable with only minor redundancy.

Run 1

Code Structure: Imports, class declaration, and initializer 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 generic names such as AutoDetect and x provide little domain context; the explicit initializer alongside attrs may also warrant explanation. Code length: Very concise, although unused imports add clutter. Action granularity: Each statement performs a single action. Reading flow: Natural top-to-bottom progression, with minor spacing improvements possible between imports and the class.

Run 2

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 initializer clearly assigns x, but the generic class and field names and unexplained auto_detect option provide little context. Code length: Very concise, although the explicit initializer may be unnecessary for a simple attrs class. Action granularity: Each statement performs one action. Reading flow: Straightforward and natural; separating standard-library and third-party imports and adding conventional blank lines would improve presentation.

Run 3

Code Structure: Imports and a single class are logically organized, though standard-library and third-party imports lack separation. Nesting: Minimal, with only a class and its initializer. Clarity of intent: The typed attribute and straightforward assignment are clear, but the interaction between auto_detect=True and the explicit initializer requires familiarity with attrs. Code length: Concise overall, although copy, re, sys, and Any are unused, and the initializer could ordinarily be generated by attrs. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom progression, with minor distractions from unused imports and slightly sparse spacing between top-level elements.