Sample

pyint-41351d8b9657-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines83

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5850–1; higher is more readable
Mi0.6150–1; higher is more readable
LLOC44Logical lines; fewer is more readable
DeepSeek V4 Pro11.330–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.550–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 AbstractUser(AbstractBaseUser, PermissionsMixin): """ An abstract base class implementing a fully featured User model with admin-compliant permissions. Username and password are required. Other fields are optional. """ username_validator = UnicodeUsernameValidator() username = models.CharField( _("username"), max_length=150, unique=True, help_text=_( "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." ), validators=[username_validator], error_messages={ "unique": _("A user with that username already exists."), }, ) first_name = models.CharField(_("first name"), max_length=150, blank=True) last_name = models.CharField(_("last name"), max_length=150, blank=True) email = models.EmailField(_("email address"), blank=True) is_staff = models.BooleanField( _("staff status"), default=False, help_text=_("Designates whether the user can log into this admin site."), ) is_active = models.BooleanField( _("active"), default=True, help_text=_( "Designates whether this user should be treated as active. " "Unselect this instead of deleting accounts." ), ) date_joined = models.DateTimeField(_("date joined"), default=timezone.now) objects = UserManager() EMAIL_FIELD = "email" USERNAME_FIELD = "username" REQUIRED_FIELDS = ["email"] class Meta: verbose_name = _("user") verbose_name_plural = _("users") abstract = True def cle(self): super().clean() self.email = self.__class__.objects.normalize_email(self.email) def get(self): """ Return the first_name plus the last_name, with a space in between. """ full = "%s %s" % (self.first_name, self.last_name) return full.strip() def get2(self): """Return the short name for the user.""" return self.first_name def email2(self, sub, mes, from2=None, **kwa): """Send an email to this user.""" send_mail(sub, mes, from2, [self.email], **kwa)

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.2849.414−94.031
Source linesThe number of non-empty source lines.83+33.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.674−7.011

Intercept 8.87 + feature contributions = -58.971 (log-odds).
Score = sigmoid(-58.971) = 0.

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.84−1.938
Indentation frequencyHow rapidly indentation changes from line to line.76+1.892
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.76−1.323
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.82.894+0.749
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.82.024+0.519
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.07+0.266
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.83.952+0.109

Intercept 0.07 + feature contributions = 0.344 (log-odds).
Score = sigmoid(0.344) = 0.585.

Score0.615
Score44
Run 1

The code demonstrates generally good structure with logical organization, appropriate use of Django model fields, clear naming conventions, and flat nesting. However, several issues impact readability: undefined imports (UserManager, PermissionsMixin), inconsistent method naming (cle, get, get2, email2 instead of clean, get_full_name, get_short_name, email_user), and method name 'get2' lacks clarity. Docstrings are helpful but placement after improperly named methods suggests incomplete refactoring. Field definitions are well-formatted with one parameter per line where appropriate. The code is concise and maintains good action granularity. Reading flow is natural for Django models but disrupted by the naming inconsistencies and missing imports. The abstract class structure is clear, and the Meta class is appropriately defined. Overall, the code follows Django conventions but is undermined by what appears to be incomplete renaming or placeholder names that obscure intent.

Run 2

The code has good structure in the model field definitions, with clear formatting and helpful help_text/error_messages. However, it suffers from severe readability issues in the method names: 'cle', 'get', 'get2', 'email2' are ambiguous and don't convey intent. The imports contain unused modules (apps, auth, make_password, ContentType, PermissionDenied, EmptyManager) which adds noise. The 'get' method's docstring describes concatenation but the method name is unclear; 'get2' returns first_name but is poorly named. The email method's parameter names ('sub', 'mes', 'from2', 'kwa') are extremely cryptic and obscure meaning. Method ordering feels arbitrary - email functionality appears after name methods without logical grouping. While the field declarations are well-structured with consistent formatting and good verbosity levels, the poor naming choices significantly reduce overall readability and maintainability.

Run 3

The code has significant readability issues. While the model field definitions are well-structured with consistent formatting and clear help texts, the method names are cryptic and misleading: 'cle()' instead of 'clean()', 'get()' instead of 'get_full_name()', 'get2()' instead of 'get_short_name()', and 'email2()' instead of 'email_user()'. Parameter names like 'sub', 'mes', 'from2', and 'kwa' obscure intent rather than clarifying it. The docstrings are minimal and don't compensate for the poor naming. Additionally, some imports appear unused (Iterable, apps, auth, ContentType, PermissionDenied, EmptyManager), and the class lacks proper method ordering—custom methods should typically follow Django's standard conventions. The overall structure follows Django model patterns, but the obfuscated naming severely impacts clarity and maintainability.

Run 1

Code Structure: Fields, configuration, metadata, and methods are logically grouped, although numerous unused imports add clutter and PermissionsMixin and UserManager are not defined or imported in the snippet. Nesting: Shallow nesting and simple methods make the code easy to follow. Clarity of intent: Descriptive field names, help text, and docstrings explain the model well, but method names such as cle, get, get2, and email2 and parameters such as sub, mes, from2, and kwa obscure intent. Code length: Mostly concise; multiline field declarations are justified by their configuration, while unused imports unnecessarily lengthen the snippet. Action granularity: Statements generally perform one action per line, with readable argument formatting. Reading flow: The progression from fields to metadata to behavior is natural, but vague method names and unresolved references interrupt comprehension.

Run 2

Code Structure: Imports, model fields, configuration, metadata, and methods are logically grouped, though several unused imports add clutter and PermissionsMixin and UserManager are not defined or imported in the snippet. Nesting: Minimal nesting; multiline field declarations are easy to follow. Clarity of intent: Descriptive field names, help text, and docstrings explain the model well, but method names cle, get, get2, and email2 and parameters sub, mes, from2, and kwa obscure intent. Code length: Mostly concise, with justified verbosity for field configuration, although imports could be trimmed. Action granularity: Each statement generally performs one clear action, without compressed compound statements. Reading flow: Consistent formatting and conventional Django organization support natural reading, but cryptic method names and missing dependencies interrupt understanding.

Run 3

Code Structure: Fields, configuration, metadata, and methods are logically grouped, although unused imports and undefined PermissionsMixin/UserManager references distract. Nesting: Minimal nesting makes the class easy to scan; multiline field declarations remain manageable. Clarity of intent: Descriptive field names, help text, and docstrings explain the model well, but cle, get, get2, email2, sub, mes, from2, and kwa obscure method purposes and parameters. Code length: Generally appropriate for a Django model, with unnecessary imports adding clutter. Action granularity: Statements generally perform one action per line, and field options are clearly separated. Reading flow: Progression from fields to metadata to behavior is natural, but cryptic method naming interrupts comprehension and requires readers to inspect implementations.