Sample

pyint-7ecf5f21bd3d-I12

Inline all eligible single-use intermediate local variables

Matched original source

Lines13

Scores

MethodScoreScale
Posnett0.0020–1; higher is more readable
Dorn0.7990–1; higher is more readable
Mi0.480–1; higher is more readable
LLOC11Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol18.670–20; mean of three runs
BTTF0.7520–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): 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.408.424−13.478
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.62−6.93
Source linesThe number of non-empty source lines.13+5.2

Intercept 8.87 + feature contributions = -6.338 (log-odds).
Score = sigmoid(-6.338) = 0.002.

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.55.857+1.299
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.057+0.393
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.912−0.229

Intercept 0.07 + feature contributions = 1.379 (log-odds).
Score = sigmoid(1.379) = 0.799.

Score0.48
Score11
Run 1

The code is highly readable with a clear, logical structure. Imports are grouped and ordered conventionally, the class definition is clean and properly extends AppConfig, and the single method `ready` has a clear intent of connecting a signal. Nesting is minimal, with only one level of class-method indentation. Action granularity is appropriate — one action per statement. The reading flow is natural: config metadata first, then behavior. The only minor deduction is that the imported `base`, `get_level_tags`, and `SimpleLazyObject` are unused, and the function `update_level_tags` is not defined in this snippet; these could cause ambiguity about intent. Overall, concise and well-structured code.

Run 2

The code is highly readable and clean. It follows a logical structure, starting with imports and then defining a single class with a clear purpose. Nesting is minimal—only one method is defined inside the class. The intent is explicit: the MessagesConfig class configures Django's messages app and connects a signal handler. Code length is concise; there are no redundant lines. Each line performs one action, preserving clarity. The reading flow is natural: imports, class definition, attributes, then method. Minor deductions: the `name` attribute is a hardcoded string that could be mistaken for a generic field, and the `ready` method’s purpose could benefit from a one-line comment or docstring, but overall clarity is strong.

Run 3

The code is highly readable. It has a clear logical structure: imports, class definition, metadata attributes, and a method. Nesting is minimal—only one method inside one class, with no conditional or loop nesting. Intent is unambiguous: it defines a Django app configuration for the messages framework and updates level tags when settings change. Code length is concise; there are no unnecessary lines. Action granularity is well-maintained, with each import and statement on its own line. Reading flow is natural, moving from imports to class definition to method. Minor deductions include the slightly ambiguous function name `update_level_tags` (intent could be clearer with a docstring) and the unused import `base` and `get_level_tags`, which detract slightly from clarity and conciseness.

Run 1

Code Structure: Imports and the app configuration class are logically organized. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names clearly convey application configuration and signal registration, though update_level_tags is not defined or imported in the snippet. Code length: Very concise, but several unused imports add minor clutter. Action granularity: Each statement performs one clear action. Reading flow: The progression from imports to configuration attributes to startup behavior is natural.

Run 2

Code Structure: Imports and the AppConfig subclass are logically organized. Nesting: Minimal, with only a class and a short method. Clarity of intent: Class metadata and signal registration clearly indicate application setup, but update_level_tags is neither defined nor imported in the snippet, and several imports are unused. Code length: Very concise, though unused imports add clutter. Action granularity: Each statement performs one clear action. Reading flow: Natural progression from imports to configuration to initialization; an additional blank line before the class would improve formatting.

Run 3

Code Structure: Imports and a single AppConfig subclass are logically organized, though several imports are unused in the shown snippet. Nesting: Minimal, with only one method inside the class. Clarity of intent: Class metadata and signal registration clearly configure Django messages, but update_level_tags is not defined or imported in the snippet. Code length: Very concise, with no unnecessary implementation. Action granularity: Each assignment and signal connection occupies its own line. Reading flow: Natural progression from imports to configuration metadata to initialization behavior; an additional blank line before the class would improve conventional formatting.