Sample

pyint-2624b3b97df7-I02

Shorten method, parameter, and local names without collisions

Matched original source

Lines43

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.5280–1; higher is more readable
Mi0.3230–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro12.670–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.60–1; higher is more readable

Views

Source code

import email.message import email.policy import mimetypes import warnings from collections import namedtuple from datetime import datetime, timezone from email import charset as Charset from email import generator from email.errors import HeaderParseError from email.header import Header from email.headerregistry import Address, AddressHeader, parser from email.mime.base import MIMEBase from email.mime.message import MIMEMessage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import formataddr, getaddresses, make_msgid from io import BytesIO, StringIO from pathlib import Path from django.conf import settings from django.core.mail.utils import DNS_NAME from django.utils.deprecation import ( RemovedInDjango70Warning, deprecate_posargs, warn_about_external_use, ) from django.utils.encoding import force_bytes, force_str, punycode from django.utils.timezone import get_current_timezone from .deprecation import ( CONNECTION_ARG_WARNING, FAIL_SILENTLY_ARG_WARNING, report_using_incompatibility, ) class SafeMIMEMultipart(MIMEMixin, MIMEMultipart): def __init__( self, sub="mixed", bou=None, sub2=None, enc=None, **par ): self.encoding = enc MIMEMultipart.__init__(self, sub, bou, sub2, **par) def __setitem__(self, nam, val2): nam, val2 = forbid_multi_line_headers(nam, val2, self.encoding) MIMEMultipart.__setitem__(self, nam, val2)

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.1627.533−53.709
Source linesThe number of non-empty source lines.43+17.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.812−7.218

Intercept 8.87 + feature contributions = -34.856 (log-odds).
Score = sigmoid(-34.856) = 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
Indentation frequencyHow rapidly indentation changes from line to line.43+0.75
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.70.932+0.661
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.43−0.566
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.44−0.522
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.062+0.336
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.42.806+0.189

Intercept 0.07 + feature contributions = 0.114 (log-odds).
Score = sigmoid(0.114) = 0.528.

Score0.323
Score31
Run 1

The code shows mixed readability. The imports are well-organized but excessively long, suggesting potential unused imports. The class SafeMIMEMultipart has a clear purpose but uses cryptic parameter names (sub, bou, sub2, enc, par, nam, val2) that obscure intent. The __init__ method has reasonable structure but the parameter abbreviations make it hard to understand without context. Nesting is minimal and flat, which is good. Action granularity is appropriate with clear single-purpose lines. The reading flow is disrupted by the abbreviated names and the unusual parameter ordering. While the code appears functional for MIME handling, the terseness of parameter names significantly reduces clarity. A developer unfamiliar with this codebase would need to trace through parent classes to understand what each parameter represents, making the code harder to maintain than necessary.

Run 2

The code has a clear, logical structure with appropriate imports and a well-defined class hierarchy. It inherits from both a mixin and MIMEMultipart, which shows intent. Nesting is minimal and readable. However, several elements reduce clarity: parameter names are cryptic (e.g., 'sub', 'bou', 'sub2', 'par', 'nam', 'val2'), which obscures intent and increases cognitive load. The constructor mixes positional and keyword arguments without clear documentation, and the line 'MIMEMultipart.__init__(self, sub, bou, sub2, **par)' repeats the parent class name instead of using super(). Action granularity is mostly one action per line, and reading flow is adequate, though some lines are long. Overall, the code is functional and organized but suffers from poor naming and lack of comments, making it only moderately readable.

Run 3

The code has a reasonable import structure and clear class naming (SafeMIMEMultipart indicates its purpose), but several issues reduce readability. The constructor uses heavily abbreviated parameter names (sub, bou, sub2, enc, par) that obscure intent. Method parameters like 'nam' and 'val2' are cryptic and inconsistent (why 'val2' not 'val'?). The __setitem__ method chains operations but the variable naming makes it harder to follow. Nesting is minimal, which is good. Action granularity is mostly reasonable, though the constructor has multiple operations with unclear ordering. The mixin inheritance pattern adds complexity without explanation. Code length is moderate but could be more explicit. The reading flow is disrupted by unclear variable names and lack of docstrings or comments explaining the safety wrapper's purpose. While not terrible, the code would be more readable with descriptive parameter names and a brief docstring.

Run 1

Code Structure: Imports are grouped before a small, focused class, but many imports are unused in the excerpt and MIMEMixin and forbid_multi_line_headers are not defined here. Nesting: Methods are flat, with no complex branching. Clarity of intent: The class name and header-validation call suggest safe MIME handling, but abbreviated parameters such as sub, bou, sub2, enc, par, nam, and val2 obscure their roles. Code length: The implementation is concise, though the import block dominates the excerpt and the multiline constructor signature is unnecessary. Action granularity: Each statement performs one clear action, with straightforward assignment and delegation. Reading flow: Constructor setup followed by header interception is natural, but excessive imports, missing context, and inconsistent naming interrupt comprehension.

Run 2

Code Structure: Imports are grouped before a compact class with logically separated initialization and header assignment, but many imports are unused in this excerpt and MIMEMixin is not defined here. Nesting: Methods are flat and easy to follow. Clarity of intent: The class name and forbid_multi_line_headers call communicate safe MIME handling, but abbreviated parameters such as bou, sub2, par, nam, and val2 obscure their roles. Code length: Method bodies are concise, although the extensive import block overwhelms the small implementation and the multiline constructor signature is unnecessary. Action granularity: Each statement performs one clear action, with no compressed multi-statement lines. Reading flow: Execution within each method is natural, but ambiguous names, missing dependency context, and the disproportionate import section interrupt comprehension.

Run 3

Code Structure: Imports are grouped before a small class with two focused methods, but many imports are unused in the shown snippet and MIMEMixin is not defined here. Nesting: Very flat, with no nested control flow. Clarity of intent: The class name and forbid_multi_line_headers call communicate safe MIME header handling, but abbreviated parameters such as sub, bou, sub2, enc, par, nam, and val2 obscure their meanings. Code length: Method bodies are concise, although the large import block overwhelms the small implementation and the constructor signature is unnecessarily spread across lines. Action granularity: Each statement performs a single clear action. Reading flow: Initialization and header validation follow a natural sequence, but cryptic names and missing local context interrupt comprehension.