Sample

pyint-a4bbf4dd8029-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines13

Scores

MethodScoreScale
Posnett0.5460–1; higher is more readable
Dorn0.9020–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 Sol17.330–20; mean of three runs
BTTF0.7990–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, age: int): self.x = age

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.221.138−7.298
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.392−6.588
Source linesThe number of non-empty source lines.13+5.2

Intercept 8.87 + feature contributions = 0.185 (log-odds).
Score = sigmoid(0.185) = 0.546.

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.643+2.24
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
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.067+0.291
Indentation frequencyHow rapidly indentation changes from line to line.13−0.287
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.12.657−0.233

Intercept 0.07 + feature contributions = 2.215 (log-odds).
Score = sigmoid(2.215) = 0.902.

Score0.699
Score10
Run 1

The code is concise and well-structured. The import block is organized, and the class definition is clear with one action per line. The explicit __init__ method clearly overrides attrs auto-detection, and the purpose is straightforward. Slight ambiguity arises from the 'x' attribute name versus 'age' parameter, but readability remains high due to minimal nesting and clear intent.

Run 2

The code is clean, concise, and well-structured. It uses modern Python features like `from __future__ import annotations` and `attrs.define`, showing clear intent. Class definition is minimal with a single attribute and a simple initializer. Nesting is absent, reading flow is natural, and each line performs one clear action. Minor deductions: unused imports (`copy`, `re`, `sys`, `Any`) slightly reduce clarity, and the class name `AutoDetect` is somewhat vague, but overall the code is highly readable.

Run 3

The code is generally readable: it has a clear, logical structure with imports followed by a single class definition. Nesting is minimal, and each action is on its own line. However, clarity of intent is somewhat reduced by the unusual combination of `attrs.define(auto_detect=True)` with a manual `__init__` that overrides automatic detection—what the class is meant to do is not obvious. The function name `AutoDetect` and parameter `age` (assigned to `x`) add ambiguity. Code length is concise, and reading flow is natural, but the mismatch between field name and parameter, plus unused imports (`copy`, `re`, `sys`, `Any`), slightly hurts readability.

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, with only a class and its initializer. Clarity of intent: The initializer clearly assigns an integer value, but generic names such as AutoDetect and x, plus the mismatch between age and x, obscure the domain purpose. The interaction between the attrs decorator and the custom initializer also requires familiarity with attrs. Code length: Short, although unused imports add unnecessary clutter. Action granularity: Each statement performs one action. Reading flow: Natural top-to-bottom progression from imports to class definition to initialization, with minor distractions from unused dependencies and inconsistent naming.

Run 2

Code Structure: Imports and a single class are logically organized, although several imports are unused and spacing between import groups could improve. Nesting: Minimal, with only a class and its constructor. Clarity of intent: The attrs decorator explicitly enables auto-detection, but generic names such as AutoDetect and x, along with the age-to-x assignment, obscure the class's purpose. Code length: Short and focused, though unused imports add unnecessary clutter. Action granularity: Each statement performs one action. Reading flow: Straightforward top-to-bottom flow, slightly weakened by import clutter and inconsistent naming.

Run 3

Code Structure: Imports and a single class are logically organized, though several imports are unused. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: The decorator and type annotations are explicit, but generic names such as AutoDetect and x, plus the age-to-x assignment, obscure the class's purpose. Code length: Very concise, with unnecessary imports adding minor clutter. Action granularity: Each line performs one action. Reading flow: Natural top-to-bottom progression, although clearer import grouping and an additional blank line before the class would improve formatting.