Sample

pyint-a91844509cc4-I05

Rewrite eligible decimal integer literals in hexadecimal notation

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 Pro17.670–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 highly readable. It uses clear imports with a logical grouping of Django utilities. The class definition is concise with appropriate metadata fields. The ready method performs four distinct setup actions, each on its own line, which makes it easy to follow. Nesting is minimal, and the intent of registering checks and connecting signals is clear. The code avoids unnecessary length and maintains a natural top-to-bottom reading flow. Minor deductions: a blank line between the import block and the class definition would enhance readability, and the ready method could benefit from a brief comment explaining its purpose.

Run 3

The code is highly readable due to its clean structure, logical import grouping, and minimal nesting. Each method performs a single clear action, and the intent is immediately apparent: this is a Django app config that registers content type signals and system checks. The imports are organized with standard library, third-party, and local modules clearly separated. The class structure is flat, with a single method containing four one-line registration calls, each representing one action. The code is concise and avoids unnecessary verbosity. Minor deductions could be made for the slightly long import from .management, but overall the code is well-structured, maintainable, and easy to understand.

Run 1

Code Structure: Imports, application metadata, and startup registrations are logically organized. Nesting: Only the class and method levels are present, with no nested control flow. Clarity of intent: Descriptive names make the migration hooks and model-check registrations clear, though understanding their behavior requires Django knowledge. Code length: The implementation is concise with no unnecessary logic. Action granularity: Each statement performs one assignment or registration. Reading flow: The code progresses naturally from dependencies to configuration to initialization. Minor spacing improvements between import groups and before the class would improve visual separation.

Run 2

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 communicate signal connections and check registration, though understanding ready() requires 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 to startup behavior; an additional blank line before the class and separation of the relative import would slightly improve formatting.

Run 3

Code Structure: Imports, application metadata, and initialization logic are logically organized. Nesting: Minimal nesting keeps the code easy to scan. Clarity of intent: Descriptive names clearly convey signal connections and check registration, though understanding ready() requires some Django familiarity. Code length: Concise, with no redundant logic. Action granularity: Each statement performs one distinct configuration action. Reading flow: The progression from dependencies to configuration to initialization is natural. Minor spacing improvements, such as separating the relative import and adding a second blank line before the class, would improve visual readability.