Sample

pyint-97486e162b1c-I13

Lower every eligible synchronous for loop to a while loop

Matched original source

Lines20

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5860–1; higher is more readable
Mi0.3490–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro180–20; mean of three runs
GPT-6.1 Sol190–20; mean of three runs
BTTF0.6830–1; higher is more readable

Views

Source code

from django.apps import AppConfig from django.contrib.contenttypes.checks import ( check_generic_foreign_keys, check_model_name_lengths, ) from django.core import checks from django.db.models.signals import post_migrate, pre_migrate from django.utils.translation import gettext_lazy as _ from .management import create_contenttypes, inject_rename_contenttypes_operations class ContentTypesConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "django.contrib.contenttypes" verbose_name = _("Content Types") def ready(self): pre_migrate.connect(inject_rename_contenttypes_operations, sender=self) post_migrate.connect(create_contenttypes) checks.register(check_generic_foreign_keys, checks.Tags.models) checks.register(check_model_name_lengths, checks.Tags.models)

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.659.022−21.748
Source linesThe number of non-empty source lines.20+8
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.59−6.885

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

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
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.058+0.376
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.21+0.293
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.82+0.192
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.19.783−0.133
Indentation frequencyHow rapidly indentation changes from line to line.20−0.045

Intercept 0.07 + feature contributions = 0.346 (log-odds).
Score = sigmoid(0.346) = 0.586.

Score0.349
Score15
Run 1

The code is highly readable with clear logical organization, minimal nesting, and natural flow. It imports necessary components in a grouped manner, defines a Django AppConfig subclass with clear configuration attributes, and implements the ready() method with one action per line. Each line expresses a distinct intent: connecting signals and registering checks. The code is concise without unnecessary verbosity, and the method names are descriptive enough to convey purpose without comments. The only minor deductions are for potential ambiguity in the sender=self argument and checks.Tags usage for those unfamiliar with Django internals, but this is standard Django boilerplate and remains clear to its target audience.

Run 2

This code is highly readable. It follows Django AppConfig conventions with a clear structure: imports are organized, the class definition is straightforward, and the ready() method clearly initializes signals and checks. Nesting is minimal—only one method with a few flat statements. Each line expresses one action, making the intent obvious: connect pre/post migration signals and register content type checks. The code is concise with no redundancy. Reading flow is natural: imports, class definition, configuration attributes, then setup logic. Minor deductions: the import from '.management' could be more explicit for newcomers, and verbose_name uses a translation call that slightly interrupts flow, but both are standard Django patterns.

Run 3

This Django app config is highly readable. The imports are logically grouped (Django core, signals, translation, local management). The class structure follows Django conventions clearly. There is no unnecessary nesting. Each method call in ready() is on its own line, making actions distinct and easy to scan. Variable names like default_auto_field, verbose_name, and ready are self-explanatory. The use of lazy translation _() and explicit sender=self shows clear intent. The code is concise with no redundancy or dead code. The only minor deductions are the slightly long import block and the fact that the purpose of inject_rename_contenttypes_operations is not immediately obvious without domain knowledge, but both are acceptable in a Django settings file.

Run 1

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Only a class and its method introduce nesting, keeping the code easy to follow. Clarity of intent: Descriptive names make signal connections and model-check registration clear, although understanding ready() requires familiarity with Django. Code length: The snippet is concise, with no unnecessary logic or repetition. Action granularity: Each statement performs one configuration or registration action. Reading flow: The progression from dependencies to metadata to initialization is natural; an additional blank line before the class would slightly improve visual separation.

Run 2

Code Structure: Imports, application metadata, and initialization logic are cleanly organized. Nesting: Minimal, with only a class and its method. Clarity of intent: Descriptive names clearly communicate signal connections and validation registration, though understanding their behavior requires Django knowledge. Code length: Concise, with no unnecessary logic. Action granularity: Each statement performs one distinct configuration action. Reading flow: Natural progression from dependencies to configuration and startup behavior. Minor spacing improvements between import groups and before the class would improve visual separation.

Run 3

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Minimal nesting, limited to a class and its method. Clarity of intent: Descriptive names clearly convey signal connections and model-check registration, though understanding ready() requires some Django familiarity. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each statement performs one configuration or registration action. Reading flow: Natural progression from dependencies to configuration and startup behavior. Minor spacing improvements between import groups and before the class would improve visual separation.