Sample

pyint-0c9bfb321073-I10

Deterministically remove some optional blank lines and bracketed line breaks

Matched original source

Lines18

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5890–1; higher is more readable
Mi0.3550–1; higher is more readable
LLOC15Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.6850–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.18+7.2
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.586−6.879

Intercept 8.87 + feature contributions = -12.557 (log-odds).
Score = sigmoid(-12.557) = 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
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.18+0.399
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.377
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.81.947+0.194
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.17.807−0.161
Indentation frequencyHow rapidly indentation changes from line to line.18−0.115

Intercept 0.07 + feature contributions = 0.358 (log-odds).
Score = sigmoid(0.358) = 0.589.

Score0.355
Score15
Run 1

The code is mostly readable but has a few style issues. The imports are logically grouped, and the class structure is clear. However, the parenthesized import for contenttypes.checks has odd indentation and the trailing comma placement is awkward. The class body is fairly flat and concise, but the ready() method could be slightly improved by separating the method definition from the class attributes with a blank line for better visual separation. Action granularity is generally good—one statement per line—but the first import statement spans multiple lines in a way that disrupts natural reading flow. The intent of each registration is clear, but the overall structure feels slightly cramped due to missing blank lines between the class attributes and the method definition. These minor issues prevent the code from reaching higher readability.

Run 2

The code is generally clear and well-structured. It follows Django conventions for app config, with logical imports at the top and a concise class definition. The class has clear attributes and a single method (ready) that registers signals and checks — each on its own line, which aids readability. There is minimal nesting and no ambiguity in intent. However, the multi-line import for check functions could be simplified to a single line for better flow. Additionally, a blank line between the class attributes and the ready method would improve visual separation. Overall, the code is readable, maintainable, and purposeful.

Run 3

The code is generally understandable but has several readability issues. The import statement has inconsistent formatting with an unusual line break and extra spaces. The class structure is clear with appropriate attributes, but the ready() method crams multiple distinct actions together without separation. While the actions are logically related, they could benefit from blank lines or comments to distinguish each signal/check registration. The lack of blank lines between class attributes and methods reduces readability. Overall it's functional but falls short of high readability standards due to formatting inconsistencies and slightly compressed code organization.

Run 1

Code Structure: Imports, configuration attributes, and initialization logic are logically organized. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Descriptive names clearly convey signal connections and model-check registration, though understanding their behavior requires Django knowledge. Code length: Concise, with no unnecessary logic. Action granularity: Each statement performs one distinct action. Reading flow: Statements follow a natural sequence, but awkward spacing in the multiline import and missing blank lines before the class and ready method slightly reduce readability.

Run 2

Code Structure: Imports, configuration attributes, and initialization logic are logically organized. Nesting: Only a class and method introduce nesting, keeping the code easy to scan. Clarity of intent: Descriptive names clearly convey content-type configuration, migration signal connections, and model checks. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each configuration assignment and registration occupies its own line. Reading flow: Initialization proceeds naturally from signal connections to check registration. Minor formatting issues—the awkward spacing in the multiline import and missing blank lines before the class and ready method—slightly reduce readability.

Run 3

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Shallow class and method nesting makes the code easy to scan. Clarity of intent: Descriptive names clearly convey signal connections and model-check registration, though understanding their effects requires Django familiarity. Code length: Concise, with no unnecessary logic or repetition. Action granularity: Each assignment, connection, and registration occupies its own line. Reading flow: Natural progression from dependencies to configuration to initialization. Minor formatting issues—the awkward spacing in the multiline import and missing blank lines before the class and method—slightly reduce readability.