Sample

pyint-d653da083303-I12

Inline all eligible single-use intermediate local variables

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 Pro170–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

The code is well-structured and readable. It imports only necessary modules, uses clear naming conventions, and organizes the app config class logically. Nesting is minimal, with the ready() method containing four straightforward method calls. Each action is on its own line, improving clarity. The reading flow is natural: imports, class definition, then method. Minor deductions: importing 'checks' both as a module and using 'checks.Tags.models' is slightly confusing, and the long import line for contenttypes checks could be reformatted. Overall, the code is concise, purposeful, and follows Django best practices, making it easy to understand for developers familiar with Django.

Run 3

The code is well-structured: the class clearly inherits from AppConfig, and its attributes (default_auto_field, name, verbose_name) are logically grouped. The ready() method connects signals and registers checks in a flat, non-nested sequence. Each action sits on its own line. The use of aliased imports and Django-specific registrations is clear, though it assumes reader familiarity with Django internals. The code is concise with no unnecessary verbosity. Only slight ambiguity exists for those unfamiliar with Django's contenttypes framework, but overall it is highly readable.

Run 1

Code Structure: Imports, configuration attributes, and startup registrations are logically organized. Nesting: Only a class and its method are nested, keeping the code easy to scan. Clarity of intent: Descriptive names clearly communicate content-type configuration, migration hooks, and model checks, though understanding ready() requires Django familiarity. Code length: Compact, with no unnecessary logic or repetition. Action granularity: Each statement performs one configuration or registration action. Reading flow: Natural progression from dependencies to metadata to initialization; an additional blank line before the class and separation of local imports would slightly improve formatting.

Run 2

Code Structure: Imports, configuration attributes, and startup registrations are logically organized. Nesting: Minimal nesting makes the class and method easy to follow. Clarity of intent: Descriptive names clearly communicate content-type configuration, migration hooks, and model checks, though understanding ready() requires some Django familiarity. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each registration or assignment occupies its own line. Reading flow: Natural progression from dependencies to configuration to initialization; grouping the relative import separately and adding another blank line before the class would slightly improve visual separation.

Run 3

Code Structure: Imports, configuration attributes, and initialization logic are logically organized within a single focused class. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names clearly convey migration signal connections and model-check registration, though understanding their behavior requires some Django knowledge. Code length: Concise, with no redundant logic. Action granularity: Each statement performs one configuration or registration action. Reading flow: The sequence naturally progresses from imports to application metadata to startup hooks. Minor spacing improvements between import groups and before the class would improve visual separation.