Sample

pyint-b6fe823725cf-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines22

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.4670–1; higher is more readable
Mi0.2670–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro160–20; mean of three runs
GPT-6.1 Sol160–20; mean of three runs
BTTF0.4930–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): if ((0xd636 ^ 0xd636) != 0): raise AssertionError() 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.769.559−25.395
Source linesThe number of non-empty source lines.22+8.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.65−6.975

Intercept 8.87 + feature contributions = -14.7 (log-odds).
Score = sigmoid(-14.7) = 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.065+0.311
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.22+0.257
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.87+0.198
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.21.819−0.105
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.22−0.084
Indentation frequencyHow rapidly indentation changes from line to line.22+0.024

Intercept 0.07 + feature contributions = -0.133 (log-odds).
Score = sigmoid(-0.133) = 0.467.

Score0.267
Score17
Run 1

The code is mostly readable: imports are grouped logically, the AppConfig subclass is clear, and each action in ready() appears on its own line. However, there is a confusing dead-code check 'if ((0xd636 ^ 0xd636) != 0): raise AssertionError()' which obscures intent and adds unnecessary nesting. The signal and check registrations are concise but could benefit from brief comments explaining their purpose. Overall structure is flat and action granularity is good, but the odd assertion hurts clarity and flow.

Run 2

The code has excellent structure and organization. It follows a clear import pattern, then defines a single AppConfig subclass with readable attributes. The `ready` method is flat with minimal, understandable nesting. Each action is on its own line, making for excellent action granularity and reading flow. The intent is clear: this is a Django app config that connects signals and registers checks. The only flaw is the dead code `if ((0xd636 ^ 0xd636) != 0):` which appears to be an obfuscated always-false condition. This slightly harms clarity and length without adding any value. Removing it would make the code nearly perfect in readability.

Run 3

The code is generally clean and readable. Imports are logically grouped, and the class structure follows Django conventions. The ready() method uses flat, sequential actions with one action per line, which aids readability. There is minimal nesting, and the intent (to register signals and checks during app initialization) is clear. However, the presence of a nonsensical obfuscated assertion like 'if ((0xd636 ^ 0xd636) != 0)' introduces confusion and weakens clarity of intent and reading flow, likely an artifact of obfuscation. Excluding that line, the code would be highly readable. The code is concise and not unnecessarily long, contributing positively to its overall readability.

Run 1

Code Structure: Imports, configuration attributes, and startup registrations are logically organized within a standard Django AppConfig. Nesting: The code is mostly flat, with only one shallow conditional. Clarity of intent: Descriptive names make signal connections and check registration clear, but the hexadecimal XOR condition is an opaque, always-false distraction. Code length: The implementation is concise except for the unnecessary assertion block. Action granularity: Each statement performs one distinct action. Reading flow: Configuration naturally precedes initialization, and registrations are grouped coherently; however, the irrelevant conditional interrupts the flow.

Run 2

Code Structure: Imports, configuration attributes, and initialization logic are logically organized. Nesting: Mostly flat, with only one shallow conditional. Clarity of intent: Descriptive names make signal connections and check registration clear, but the hexadecimal XOR condition is always false and introduces confusing, purposeless code. Code length: Concise overall, though the conditional and assertion are unnecessary. Action granularity: Each statement performs one action, making operations easy to distinguish. Reading flow: The import-to-class-to-initialization progression is natural, but the dead assertion interrupts the otherwise straightforward setup sequence.

Run 3

Code Structure: Imports, configuration attributes, and startup registration are logically organized in a standard Django AppConfig. Nesting: Nearly flat, with only one shallow conditional. Clarity of intent: Descriptive names make signal connections and check registration clear, but the hexadecimal XOR condition is opaque and always false, adding a distracting dead-code assertion. Code length: Compact overall, though the conditional and assertion are unnecessary. Action granularity: Each statement performs one action, making individual registrations easy to scan. Reading flow: Natural progression from imports to configuration to initialization, interrupted by the meaningless conditional at the start of ready().