Sample

pyint-8a66e9d116f8-I07

Insert deterministic runtime-dead branches into callable bodies

Matched original source

Lines47

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3420–1; higher is more readable
Mi0.4930–1; higher is more readable
LLOC35Logical lines; fewer is more readable
DeepSeek V4 Pro11.670–20; mean of three runs
GPT-6.1 Sol130–20; mean of three runs
BTTF0.4080–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, _subtype="mixed", boundary=None, _subparts=None, encoding=None, **_params ): if ((0xa4bc ^ 0xa4bc) != 0): raise AssertionError() self.encoding = encoding MIMEMultipart.__init__(self, _subtype, boundary, _subparts, **_params) def __setitem__(self, name, val): if ((0xb51f ^ 0xb51f) != 0): raise AssertionError() name, val = forbid_multi_line_headers(name, val, self.encoding) MIMEMultipart.__setitem__(self, name, val)

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.1852.06−61.118
Source linesThe number of non-empty source lines.47+18.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.822−7.233

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

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.47+0.889
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.48−0.663
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.47−0.658
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.067+0.286
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.46.807+0.244
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.958−0.018

Intercept 0.07 + feature contributions = -0.654 (log-odds).
Score = sigmoid(-0.654) = 0.342.

Score0.493
Score35
Run 1

The code shows some organizational structure with clear imports and a logical class hierarchy, but several issues reduce readability. The SafeMIMEMultipart class includes suspicious dead code (assertion checks that always pass) which obscures intent and adds noise. Constructor parameters use underscore prefixes, while _subtype and _subparts signal internal use but are passed as positional arguments, creating ambiguity. The __setitem__ method has moderate clarity but relies on an external function (forbid_multi_line_headers) not shown, making it harder to understand. Nesting is minimal, and action granularity is acceptable, but the overall code is verbose with redundant assertions that could mislead readers. Import statements are well-organized, but unused imports (e.g., BytesIO, Path, warnings) further reduce clarity. The code could be more concise and maintainable by removing dead code and explaining boundary handling or header sanitization. Overall, it's readable in structure but weakened by unnecessary complexity and hidden dependencies.

Run 2

The code has a reasonable structure with clear imports and a simple class hierarchy, but it suffers from several readability issues. The presence of dead code (`if ((0xa4bc ^ 0xa4bc) != 0): raise AssertionError()`) is confusing and serves no purpose. The `SafeMIMEMultipart.__init__` method has multiple parameters on one line, reducing clarity. Nesting is minimal, which is good, but the intent of the class is unclear without additional context. The code is concise, but the odd assertion checks make it unnecessarily complex. Action granularity is mostly fine, but reading flow is disrupted by the dead code and redundant operations. Overall, the code could be more readable by removing unnecessary elements and clarifying the class's purpose.

Run 3

The code is reasonably structured with clear imports and a straightforward class definition, but it suffers from significant readability issues. The unnecessary assertions that always evaluate to false (e.g., 'if ((0xa4bc ^ 0xa4bc) != 0)') add confusion and pointless complexity, obscuring the actual logic. While nesting is minimal and lines generally follow one-action-per-line, the presence of these dead-code assertions breaks reading flow and makes the intent unclear. The use of **kwargs and positional args like _subtype, boundary, and _subparts is not immediately obvious without external context. Action granularity is mostly good, but the encoding handling and MIMEMultipart initialization could be clearer. Overall, the code is maintainable but would benefit from removing the noise and adding more explicit comments or docstrings for clarity.

Run 1

Code Structure: Imports and the class are logically organized, but many imports are unused in this snippet, and external dependencies such as MIMEMixin are not shown. Nesting: Both methods remain shallow, with only one conditional level. Clarity of intent: MIME initialization and header validation are understandable, but the hexadecimal XOR checks always evaluate to false and obscure the purpose. Code length: The methods are concise, yet redundant assertions and the extensive import list add unnecessary bulk. Action granularity: Most lines perform a single operation; tuple assignment naturally groups related header values. Reading flow: Conventional method ordering and straightforward delegation support readability, but meaningless checks interrupt both methods, while missing helper definitions require outside context.

Run 2

Code Structure: The class is logically organized into initialization and header assignment, but the extensive imports distract from the small implementation. Nesting: Both methods are shallow, with only one conditional level. Clarity of intent: Method names and MIME-related calls communicate purpose, but unexplained hexadecimal XOR checks obscure intent, and helper definitions are absent from the snippet. Code length: The implementation is short, yet redundant assertion branches and numerous unused imports make it unnecessarily verbose. Action granularity: Most lines perform one clear action; the tuple assignment naturally groups header validation results. Reading flow: Initialization and header validation follow a straightforward sequence, but always-false checks interrupt that flow, and limited spacing between imports and the class weakens visual separation.

Run 3

Code Structure: Imports and class methods are logically organized, but many imports are unused in this snippet, and MIMEMixin and forbid_multi_line_headers are not defined here. Nesting: Both methods remain shallow, with only one conditional level. Clarity of intent: Method names and MIME delegation communicate the purpose, but the hexadecimal XOR checks are always false and introduce distracting, unexplained assertions. Code length: The actual functionality is concise, while the extensive imports and redundant checks add unnecessary length. Action granularity: Statements generally perform one action per line; unpacking the validated header pair is conventional and readable. Reading flow: Initialization and header validation follow natural sequences, but the dead checks interrupt both methods and obscure otherwise straightforward logic.