Sample

pyint-55748655a7f3-I12

Inline all eligible single-use intermediate local variables

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 readable: it has logical imports, a single class, and a simple constructor with clear intent. The use of `attrs.define(auto_detect=True)` is concise but potentially ambiguous—`auto_detect` is not a standard attrs parameter, which may confuse readers. The class has only one attribute and one method, keeping nesting flat and actions granular. However, the `__init__` is redundant with attrs' auto-generated initializer, adding unnecessary length. The structure is simple and natural to follow, but the overall purpose of `auto_detect=True` is unclear without additional context.

Run 3

The code is highly readable. It has a clear structure with a single, well-defined class. Nesting is minimal, with only one method. Intent is clear: define a class with a simple integer attribute. Code length is concise and appropriate. Action granularity is one action per line. Reading flow is natural. Minor deductions: the redundant `__init__` and `auto_detect=True` could be simplified, but overall the code is clean, idiomatic, and easy to understand.

Run 1

Code Structure: Imports, class declaration, and initialization are logically organized, though several imports are unused. Nesting: Minimal, limited to a class and its method. Clarity of intent: The typed field and straightforward initializer are clear, but the generic names and unexplained auto_detect 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; separating standard-library and third-party imports and adding another blank line before the class would improve presentation.

Run 2

Code Structure: Imports and a single class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed field and simple initializer are clear, but the generic class name and unexplained auto_detect setting provide limited context. Code length: Very concise, although attrs could generate the initializer, depending on the intended purpose. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom flow; additional spacing between import groups and the class would improve formatting.

Run 3

Code Structure: Imports and the class are logically organized, although several imports are unused and spacing between sections could improve. Nesting: Minimal nesting makes the code easy to follow. Clarity of intent: The typed field and straightforward initializer clearly establish how x is stored, but the generic class name and unexplained auto_detect setting provide little context. Code length: Very concise, though unused imports add clutter and the explicit initializer may be unnecessary with attrs. Action granularity: Each line performs a single action. Reading flow: Natural top-to-bottom progression from imports to declaration to initialization, with only minor formatting distractions.