Sample

pyint-153d5fc1a636-SRC

Unmodified source class

Lines24

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.580–1; higher is more readable
Mi0.4430–1; higher is more readable
LLOC17Logical lines; fewer is more readable
DeepSeek V4 Pro16.670–20; mean of three runs
GPT-6.1 Sol180–20; mean of three runs
BTTF0.7430–1; higher is more readable

Views

Source code

from collections.abc import Iterable from django.apps import apps from django.contrib import auth from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager from django.contrib.auth.hashers import make_password from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.core.mail import send_mail from django.db import models from django.db.models.manager import EmptyManager from django.utils import timezone from django.utils.translation import gettext_lazy as _ from .validators import UnicodeUsernameValidator class PermissionManager(models.Manager): use_in_migrations = True def get_by_natural_key(self, codename, app_label, model): return self.get( codename=codename, content_type=ContentType.objects.db_manager(self.db).get_by_natural_key( app_label, model ), )

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.901.892−29.762
Source linesThe number of non-empty source lines.24+9.6
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.562−6.843

Intercept 8.87 + feature contributions = -18.136 (log-odds).
Score = sigmoid(-18.136) = 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.383
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.25+0.151
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.84+0.107
Indentation frequencyHow rapidly indentation changes from line to line.24+0.093
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.23.906−0.076

Intercept 0.07 + feature contributions = 0.322 (log-odds).
Score = sigmoid(0.322) = 0.58.

Score0.443
Score17
Run 1

The code demonstrates good readability. Structure is logical: imports are grouped, and the class has a clear purpose. Nesting is minimal—only one nested call inside `get_by_natural_key`, which is necessary and clearly formatted. Intent is clear: the manager retrieves a permission by its natural key components. Code length is concise; no extra methods or comments are needed. Action granularity is appropriate: one meaningful action per line, with keyword arguments kept on separate lines for clarity. Reading flow is natural—signature, return, and nested call follow a top-to-bottom order. Minor deductions: unused imports (`auth`, `AbstractBaseUser`, etc.) could confuse readers, and the `use_in_migrations = True` line lacks context for novices, but these are minor. Overall, the code is well-structured and easy to follow.

Run 2

The code is highly readable with a clear, logical structure. Imports are organized and follow Django conventions, and the class definition with its single method is concise and focused. The method body demonstrates shallow nesting, with only one nested function call that is clearly indented and easy to follow. Intent is unambiguous: it retrieves a permission by natural key using ContentType lookup. Action granularity is excellent — one logical action per line. The reading flow is natural: from imports to class definition to method logic. The only minor deduction is because `get_by_natural_key` uses a slightly long nested call for ContentType that could optionally be split for absolute clarity, but overall this remains very clean, maintainable, and readable code.

Run 3

The code is well-structured and readable. It has a clear and logical organization: imports are grouped and ordered (standard library, Django libs, local), followed by a class definition. Nesting is minimal, with only one method containing a single nested call, which is acceptable. Intent is clear—the PermissionManager is a model manager that retrieves permissions by natural key. While the file is short, it is complete for its purpose; no unnecessary code is present. Action granularity is mostly one action per line, though the nested get_by_natural_key call could be broken out for slightly better readability. Reading flow is natural, moving from imports to class definition to method logic. Overall, it is concise and maintainable, with only a minor opportunity to reduce nesting.

Run 1

Code Structure: Imports precede a clearly defined manager class, providing logical organization, though many imports are unused in this snippet. Nesting: Shallow class and method nesting is easy to follow; the nested lookup adds only minor complexity. Clarity of intent: Descriptive names clearly communicate retrieval of a permission by its natural key. Code length: The implementation is concise, but the unused imports add clutter. Action granularity: Each statement performs a coherent action, with the related content-type lookup naturally embedded in the query. Reading flow: Conventional formatting and multiline arguments support smooth reading, although an additional blank line before the class would improve separation.

Run 2

Code Structure: Imports and a focused manager class are logically organized, though most imports are unused in this snippet. Nesting: Minimal control-flow nesting; the nested lookup is clearly formatted. Clarity of intent: Descriptive class, method, and parameter names communicate retrieval of a permission by its natural key. Code length: The implementation is concise, but the unused imports add clutter. Action granularity: Statements are distinct, although the return expression combines content-type retrieval with permission retrieval. Reading flow: Conventional Django patterns and consistent indentation make the code easy to follow; extracting the content-type lookup could slightly improve readability.

Run 3

Code Structure: Imports and a focused manager class are logically organized, although many imports are unused in this snippet. Nesting: Shallow overall; the nested content-type lookup is straightforward and formatted clearly. Clarity of intent: Descriptive class, method, and parameter names make the natural-key permission lookup understandable, especially to Django developers. Code length: The method is concise, but the extensive import list adds unnecessary length to the shown code. Action granularity: The return expression combines two related lookups, with clear line breaks separating their arguments. Reading flow: Execution proceeds naturally from the manager definition to the lookup method; conventional formatting makes it easy to follow.