Sample

pyint-66cdff1b8679-I03

Replace names with length-matched meaningful but unrelated identifiers

Matched original source

Lines43

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3670–1; higher is more readable
Mi0.4190–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro3.670–20; mean of three runs
GPT-6.1 Sol110–20; mean of three runs
BTTF0.5460–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, customer="mixed", nextData=None, timestamp=None, schedule=None, **profile ): self.encoding = schedule MIMEMultipart.__init__(self, customer, nextData, timestamp, **profile) def __setitem__(self, user, map): user, map = forbid_multi_line_headers(user, map, self.encoding) MIMEMultipart.__setitem__(self, user, map)

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.764−7.147

Intercept 8.87 + feature contributions = -34.785 (log-odds).
Score = sigmoid(-34.785) = 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
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.06+0.356
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.42.784+0.188
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.86.977−0.019

Intercept 0.07 + feature contributions = -0.547 (log-odds).
Score = sigmoid(-0.547) = 0.367.

Score0.419
Score31
Run 1

The code is severely unreadable. The import block is overlong and mixes standard library, Django, and local imports without clear organization. The class SafeMIMEMultipart has misleading parameter names (customer, nextData, timestamp, schedule, profile) that do not reflect their actual purpose, making intent ambiguous. The constructor performs assignment (self.encoding = schedule) but never uses self.encoding within the class, adding confusion. Action granularity is poor: multiple operations are crammed into single lines (e.g., user, map = forbid_multi_line_headers(...)). The override of __setitem__ with parameter names 'user' and 'map' obscures the header key/value semantics. Overall, the code lacks clarity and natural reading flow.

Run 2

The code falls into the unreadable range. Structure is poor: SafeMIMEMultipart inherits from MIMEMixin (undefined) and MIMEMultipart while its __init__ overwrites self.encoding with the 'schedule' parameter, which semantically clashes with the inherited meaning of encoding. Parameter names are extremely misleading (customer instead of subtype, nextData instead of boundary, timestamp instead of policy, schedule instead of encoding), making intent ambiguous and violating the principle of clarity. Nesting is low, but code length is unnecessarily inflated by this semantic obfuscation. Action granularity is acceptable (one action per line in __setitem__), but the reading flow is unnatural because variables like 'user' and 'map' actually represent header name and value. The method __setitem__ also calls forbid_multi_line_headers which is not shown, further obscuring behavior. Deprecation imports are numerous and unused in this snippet, adding noise. Overall, the code reads like intentionally mangled code, requiring external context to understand its true purpose.

Run 3

The code is highly unreadable due to severely misleading naming and tangled structure. Parameters like 'customer', 'nextData', 'timestamp', and 'schedule' map incorrectly to standard MIME concepts ('subtype', 'policy', 'boundary', '_charset'), obscuring intent. 'map' and 'user' are used for header name/value, which is confusing. Variable naming is inconsistent ('nextData' vs snake_case). The import block is overly long and mixes Django internals with standard library, making it hard to discern actual dependencies. The SafeMIMEMultipart class inherits from MIMEMixin without showing its definition, adding ambiguity. The __init__ method performs multiple unclear data transformations in a few lines, violating action granularity. The overall reading flow is unnatural: the reader must reverse-engineer variable meanings before understanding the simple purpose of extending MIMEMultipart to sanitize headers. Concise but cryptic, the code sacrifices clarity for brevity. A score of 4 reflects minimal readability with substantial risk of misinterpretation.

Run 1

Code Structure: The class and its two methods are logically organized, but the extensive import block overwhelms the small implementation, with most imports unused in this snippet. Nesting: Methods are flat and easy to scan. Clarity of intent: The class name and header-validation call suggest safe multipart email handling, but parameter names such as customer, nextData, timestamp, schedule, profile, user, and map obscure MIME concepts; map also shadows a built-in. MIMEMixin and forbid_multi_line_headers are not defined or imported in the excerpt, reducing self-contained understanding. Code length: Methods are concise, while the imports add considerable reading overhead. Action granularity: Each statement performs a focused operation, and tuple unpacking is straightforward. Reading flow: Initialization followed by header assignment is natural, but misleading names and unexplained dependencies interrupt comprehension.

Run 2

Code Structure: Imports precede a small class with clearly separated methods, but numerous unused imports obscure the relevant dependencies. Nesting: Methods are flat and easy to scan. Clarity of intent: The class name and header-validation call suggest safe MIME handling, but parameter names such as customer, nextData, timestamp, schedule, profile, user, and map conceal their actual roles; map also shadows a built-in. MIMEMixin and forbid_multi_line_headers are not defined or imported in the snippet, limiting standalone understanding. Code length: The methods are concise, but the import block is disproportionately long for the functionality shown. Action granularity: Statements generally perform one action per line; tuple unpacking is straightforward. Reading flow: Constructor initialization followed by header assignment is logical, but misleading names and irrelevant imports interrupt comprehension.

Run 3

Code Structure: Imports are grouped above a small, logically organized class, but many appear unrelated to this snippet, and MIMEMixin and forbid_multi_line_headers lack visible definitions. Nesting: Very shallow, with no nested control flow. Clarity of intent: The class name suggests safe MIME handling, but misleading parameter names such as customer, nextData, timestamp, schedule, profile, user, and map obscure their MIME roles; map also shadows a built-in. Code length: Methods are concise, although the extensive import block overwhelms the actual implementation. Action granularity: Statements generally perform one action per line, with a straightforward tuple assignment for header validation. Reading flow: Initialization followed by header assignment is natural, but inconsistent naming and indirect mappings such as schedule to encoding force readers to infer meaning.