Sample

pyint-8e5d1ebbc6f3-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines19

Scores

MethodScoreScale
Posnett0.1050–1; higher is more readable
Dorn0.7360–1; higher is more readable
Mi0.4650–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro10.670–20; mean of three runs
GPT-6.1 Sol140–20; mean of three runs
BTTF0.0670–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): previous_number = 0 current_number = 1 for sequence_step in range(4): next_number = previous_number + current_number previous_number = current_number current_number = next_number 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.372.603−12.296
Source linesThe number of non-empty source lines.19+7.6
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.211−6.316

Intercept 8.87 + feature contributions = -2.142 (log-odds).
Score = sigmoid(-2.142) = 0.105.

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.58+1.209
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.432
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.19+0.364
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.18.814−0.147
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.19−0.015

Intercept 0.07 + feature contributions = 1.028 (log-odds).
Score = sigmoid(1.028) = 0.736.

Score0.465
Score16
Run 1

The code is syntactically clean and short, but its intent is unclear. The class is named AutoDetect, yet no auto-detection occurs. The __init__ method performs a Fibonacci-like calculation with unused variables (previous_number, current_number, next_number) that have no effect on the assigned attribute self.x. This dead code makes the purpose ambiguous and misleading. Structure is logical but minimal; nesting is flat; line-level action granularity is fine. However, reading flow suffers because the calculation appears disconnected from the class's stated purpose. Clarity of intent and code length are penalized by the useless loop. Overall, readability is moderate but reduced by the confusing, nonfunctional logic and misleading naming.

Run 2

The code has a clear structure with proper imports and a single class definition. However, it contains dead code: the Fibonacci sequence calculation in __init__ has no effect on the final assignment of self.x, which obscures the intent. The nesting is flat, and action granularity is good, but the unnecessary loop adds length and confusion. Reading flow is interrupted by the irrelevant computation. Using attrs.define with a custom __init__ that ignores the auto-detected field further complicates clarity. Overall, the code is readable in terms of syntax, but fails on clarity of intent and concise logic.

Run 3

The code is structurally simple but confusing. The class is named AutoDetect and uses attrs.define with auto_detect=True, yet it also defines a manual __init__ that ignores attrs' generated initializer, creating ambiguity about intent. The loop appears to compute Fibonacci numbers but does nothing with the results, making its purpose unclear. Nesting is low, and actions are reasonably granular, but the unused loop adds unnecessary length and distracts from the actual assignment. Reading flow is disrupted by the irrelevant computation. Overall, the code is readable in terms of syntax but suffers from unclear purpose and dead logic.

Run 1

Code Structure: Imports and the class are logically organized, but unused imports and an unrelated calculation add clutter. Nesting: Only one shallow loop makes the code easy to follow. Clarity of intent: Descriptive variable names clarify the Fibonacci-style calculation, but its purpose is unclear because its result is discarded; the generic class name also provides little context. Code length: The snippet is short, yet the loop and several imports are unnecessary for assigning x. Action granularity: Each statement performs one action, supporting readability. Reading flow: Execution is straightforward, but the irrelevant calculation interrupts the natural flow from initialization to attribute assignment.

Run 2

Code Structure: Imports and the class are organized conventionally, but unused imports and an unrelated sequence calculation clutter the initializer. Nesting: Shallow nesting makes the code easy to scan. Clarity of intent: Assigning x is clear, but the purpose of the Fibonacci-like loop is unexplained, its result is unused, and AutoDetect is a vague class name. Code length: Short overall, yet unnecessarily long for an initializer that effectively only assigns self.x. Action granularity: Each statement performs one action, and descriptive variable names help readability. Reading flow: The layout is natural, but the unused calculation interrupts the straightforward path from initialization to attribute assignment.

Run 3

Code Structure: Imports and a single class provide a straightforward organization, but unused imports and an unrelated calculation add clutter. Nesting: Shallow nesting makes the code easy to scan. Clarity of intent: The class stores x, but the Fibonacci-style loop has no effect on its state, obscuring the constructor's purpose; auto_detect=True is also unexplained. Code length: Short overall, yet unnecessarily extended by unused imports and the ineffective loop. Action granularity: Each statement performs one action, with descriptive variable names. Reading flow: The layout is mostly natural, but readers must work through an irrelevant sequence calculation before reaching the meaningful assignment.