Sample

pyint-2cabdce36f79-I08

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

Matched original source

Lines26

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.6130–1; higher is more readable
Mi0.2210–1; higher is more readable
LLOC20Logical lines; fewer is more readable
DeepSeek V4 Pro14.330–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.3990–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): first_score = 72 second_score = 85 if first_score > second_score: higher_score = first_score else: higher_score = second_score 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.796.181−26.274
Source linesThe number of non-empty source lines.26+10.4
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.516−6.774

Intercept 8.87 + feature contributions = -13.778 (log-odds).
Score = sigmoid(-13.778) = 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
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.055+0.408
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
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.963+0.194
Indentation frequencyHow rapidly indentation changes from line to line.26+0.162
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.25.819−0.049

Intercept 0.07 + feature contributions = 0.459 (log-odds).
Score = sigmoid(0.459) = 0.613.

Score0.221
Score20
Run 1

The code is generally readable and logically organized. Imports are clear and grouped, and the class structure follows Django conventions. Nesting is minimal, with only a simple if/else block. Clarity of intent is mostly clear, but the unrelated 'first_score', 'second_score', and 'higher_score' logic is ambiguous and appears to be placeholder or unrelated code that reduces clarity. Code length is concise overall. Action granularity is good—each signal connection or check registration is on its own line. Reading flow is natural, moving from configuration to setup actions, but the unrelated score comparison interrupts this flow. The method name 'ready' is meaningful within Django's app config lifecycle. Overall, the code is readable, but the extraneous scoring logic is confusing and should be removed or explained.

Run 2

The code is mostly readable with clean imports and clear AppConfig structure, but it contains an irrelevant block of dead code (the first_score/second_score comparison) that serves no purpose within the method. This distracts from the actual intent and should be removed. Nesting is flat, and actions are generally one per line, but the unrelated conditional adds unnecessary length and ambiguity. The signal connections and check registrations are straightforward and logically organized, but the presence of the dead code disrupts reading flow and makes the purpose of `ready()` less clear. Overall, it is readable but would be significantly improved by removing the unrelated score comparison.

Run 3

The code is generally readable but has some issues. The imports are well-organized, and the AppConfig subclass follows Django conventions with clear attributes. However, there's a confusing block of dead code (the first_score/second_score comparison) that serves no purpose and obscures intent. The ready() method contains multiple unrelated actions—connecting signals and registering checks—without clear separation, making the method's purpose less obvious. The code structure is mostly flat and logical, but the dead code disrupts the natural reading flow and adds unnecessary length. The signal connections and check registrations are clear, though a comment or grouping could improve clarity. Overall, it's functional but would benefit from removing the dead code and adding slight organization to the ready() method.

Run 1

Code Structure: Imports, configuration attributes, and initialization are logically organized, but the unrelated score comparison disrupts the method's cohesion. Nesting: A single shallow if/else keeps complexity low. Clarity of intent: Descriptive names make signal connections and check registrations clear; however, the purpose of higher_score is unclear because it is never used. Code length: Mostly concise, though the unused score calculation adds unnecessary lines and could be removed. Action granularity: Each line performs one clear assignment, comparison, or registration. Reading flow: The standard Django configuration layout is easy to follow, but the arbitrary score calculation interrupts the natural progression from configuration to setup.

Run 2

Code Structure: Imports, configuration attributes, and initialization are logically organized, but the unrelated score comparison disrupts cohesion. Nesting: Only a single shallow if/else keeps the code easy to follow. Clarity of intent: Django signal connections and check registrations communicate their purpose clearly; the unused higher_score calculation has no apparent role. Code length: Mostly concise, though the score calculation adds unnecessary lines. Action granularity: Each statement performs one action, with no compressed or compound operations. Reading flow: The configuration-to-initialization progression is natural, but the arbitrary score logic interrupts it before the relevant setup calls.

Run 3

Code Structure: Imports, configuration attributes, and initialization are logically organized, but the unrelated score comparison disrupts cohesion. Nesting: Only one shallow if/else block, making the code easy to follow. Clarity of intent: Django configuration and signal/check registration are clear; the purpose of the score variables and unused higher_score is unexplained. Code length: Mostly concise, though the score comparison adds unnecessary lines and could be removed. Action granularity: Each statement performs one action, with no compressed multi-action lines. Reading flow: Familiar Django structure and descriptive names support natural reading, but the irrelevant comparison interrupts the initialization sequence.