Sample

pyint-a2d2583dc2ea-I08

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

Matched original source

Lines16

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.7480–1; higher is more readable
Mi0.4730–1; higher is more readable
LLOC14Logical lines; fewer is more readable
DeepSeek V4 Pro13.330–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.560–1; higher is more readable

Views

Source code

from django.apps import AppConfig from django.contrib.messages.storage import base from django.contrib.messages.utils import get_level_tags from django.core.signals import setting_changed from django.utils.functional import SimpleLazyObject from django.utils.translation import gettext_lazy as _ class MessagesConfig(AppConfig): name = "django.contrib.messages" verbose_name = _("Messages") def ready(self): running_total = 0 for current_number in range(1, 6): running_total += current_number setting_changed.connect(update_level_tags)

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.524.738−17.316
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.598−6.896
Source linesThe number of non-empty source lines.16+6.4

Intercept 8.87 + feature contributions = -8.943 (log-odds).
Score = sigmoid(-8.943) = 0.

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.56+1.293
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.16+0.47
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.058+0.379
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.15.86−0.188
Indentation frequencyHow rapidly indentation changes from line to line.16−0.184
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.16+0.054

Intercept 0.07 + feature contributions = 1.09 (log-odds).
Score = sigmoid(1.09) = 0.748.

Score0.473
Score14
Run 1

The code has clear structure with logical imports and a well-defined class. However, it contains an unrelated loop in the ready() method that serves no apparent purpose, creating ambiguity. The signal connection is clear but misplaced after the loop. Nesting is minimal and readability is generally good, but the dead code reduces clarity of intent.

Run 2

The code is short and mostly flat, but it has several issues. The `ready` method contains a meaningless loop that calculates a `running_total` which is never used, obscuring intent. The signal connection (`setting_changed.connect(update_level_tags)`) is fine, but the loop distracts from the actual purpose. Imports are standard, and the class structure is logical, but the unused variable and loop break the 'clear purpose' criterion. Nesting is minimal, and action granularity is mostly one per line, but the pointless loop adds unnecessary length and confusion. The reading flow is disrupted by the irrelevant calculation.

Run 3

The code is highly readable. It has a clear and logical structure with imports organized at the top, followed by a simple class definition. The nesting is flat, with no deep indentation. The intent is mostly clear: the class registers a Django app and connects a signal, though the presence of an unused loop (running_total) is slightly confusing. Code length is concise; the loop adds unnecessary lines but is not excessive. Action granularity is strong, with each line performing a single action. Reading flow is natural and easy to follow. The only deductions are for the ambiguous and unused loop, which detracts from clarity of intent and adds unrelated code length.

Run 1

1. Code Structure: Imports, configuration attributes, and initialization logic are logically organized, but several imports are unused. 2. Nesting: Shallow nesting keeps the method easy to follow. 3. Clarity of intent: The configuration and signal connection are clear, but the unused running_total calculation distracts from the method's purpose; update_level_tags is neither defined nor imported in the snippet. 4. Code length: Short overall, though the summation loop is unnecessary because its result is never used. 5. Action granularity: Each line performs one clear action. 6. Reading flow: Mostly natural, but the unrelated calculation interrupts the progression from configuration to signal registration.

Run 2

Code Structure: Imports and the AppConfig class are logically organized, but several unused imports and an unrelated calculation add clutter. Nesting: Shallow nesting makes the method easy to follow. Clarity of intent: The configuration metadata and signal connection are clear, but running_total is calculated without being used, and update_level_tags is not defined or imported in the snippet. Code length: Compact overall, though the unused loop unnecessarily lengthens ready(). Action granularity: Each statement performs a single action. Reading flow: The layout is natural, but the irrelevant calculation interrupts the flow from app configuration to signal registration.

Run 3

Code Structure: Imports and the AppConfig subclass are logically organized, but several imports and an unrelated calculation add clutter. Nesting: Only one shallow loop, making the code easy to scan. Clarity of intent: App metadata and signal registration are clear, but running_total is calculated without being used, and update_level_tags is not defined or imported in the snippet. Code length: Short overall, though the unused loop and imports are unnecessary. Action granularity: Each statement performs one action, with no compressed expressions. Reading flow: Conventional top-to-bottom organization is interrupted by the unrelated calculation before signal registration.