Sample

pyint-458fb090437b-I11

Split eligible integer literals into pairs of short-named intermediate variables

Matched original source

Lines43

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Dorn0.3670–1; higher is more readable
Mi0.4230–1; higher is more readable
LLOC31Logical lines; fewer is more readable
DeepSeek V4 Pro11.330–20; mean of three runs
GPT-6.1 Sol170–20; mean of three runs
BTTF0.6770–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 ): self.encoding = encoding MIMEMultipart.__init__(self, _subtype, boundary, _subparts, **_params) def __setitem__(self, name, val): 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.1623.002−53.559
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.792−7.188

Intercept 8.87 + feature contributions = -34.677 (log-odds).
Score = sigmoid(-34.677) = 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.423
Score31
Run 1

The code is moderately readable but has several issues. The import section is lengthy but organized by type. The class definition is simple, but the __init__ method contains multiple operations in a single line and lacks type hints or docstrings. The __setitem__ method chains a helper function call with a parent method call, which reduces clarity. The use of double underscores and mixing of MIMEMixin and MIMEMultipart inheritance creates ambiguity about the class's true purpose. While the code is flat and not deeply nested, the lack of comments explaining the safety wrapper's intent hurts comprehension. The variable naming like _subtype and **_params is conventional for MIME but may confuse newcomers. Overall, the code is functional but could benefit from better documentation and clearer separation of actions.

Run 2

The code demonstrates solid structure with clear import organization, logical class inheritance via a mixin, and a straightforward constructor. Nesting is minimal, and methods follow single-responsibility principles with clear intent — particularly in __setitem__ which explicitly sanitizes headers before delegation. The reading flow is natural, aided by type hints and named parameters. Minor deductions: SafeMIMEMultipart overrides __init__ without calling super(), instead invoking MIMEMultipart.__init__ directly, which could confuse maintainers. Some imports (e.g., datetime, warnings, deprecation utilities) appear unused in the snippet, adding noise. Overall, it is concise, readable, and purposeful.

Run 3

The code is largely unreadable due to several factors. It begins with a sprawling import block that mixes standard library, third-party, and local imports without clear grouping or organization. The class definition is brief but lacks context, and the constructor contains a parameter that appears to be single-use and an underscore-prefixed parameter convention that feels inconsistent. The method __setitem__ invokes a helper function whose purpose is not apparent from the surrounding code, and the overall intent of the class is ambiguous. The code is short, but this brevity does not equate to clarity; instead, it feels fragmentary and assumes significant domain knowledge. Nesting is minimal, which is positive, but the lack of logical structure, unclear naming, and scattered imports undermine readability. The reading flow is disrupted by the abrupt class definition and the unexplained helper call, making the code difficult to assess without additional context.

Run 1

Code Structure: Imports precede a focused class with two clearly separated methods, although many imports are unused in this excerpt. Nesting: Flat method bodies are easy to follow. Clarity of intent: The class name and header-validation call clearly communicate safe multipart handling, but MIMEMixin and forbid_multi_line_headers are not defined or imported in the snippet. Code length: The class is concise; the extensive import block adds reading overhead relative to its size. Action granularity: Each statement performs a single, identifiable action. Reading flow: Initialization followed by header assignment is natural, with consistent formatting and readable argument wrapping.

Run 2

Code Structure: Imports precede a small, logically organized class with separate initialization and header-setting responsibilities, although many imports are unused in this excerpt. Nesting: Flat methods with no nested control flow make the code easy to scan. Clarity of intent: Descriptive class and helper names communicate safe multipart header handling, but MIMEMixin and forbid_multi_line_headers are not defined or imported in the excerpt, and val is a generic name. Code length: The class is concise; the extensive import block dominates the snippet and adds distraction. Action granularity: Each statement performs a distinct operation, with tuple unpacking naturally grouping related values. Reading flow: Initialization followed by header assignment provides a natural progression, though additional spacing between imports and the class would improve visual separation.

Run 3

Code Structure: Imports are grouped coherently, and the class separates initialization from header assignment, though many imports are unused in this excerpt. Nesting: Flat method bodies make the code easy to scan. Clarity of intent: Descriptive names clearly convey multipart initialization and header sanitization; however, MIMEMixin and forbid_multi_line_headers are not defined in the excerpt, limiting standalone understanding. Code length: The class is concise, but the extensive import block outweighs the implementation shown. Action granularity: Each statement performs a distinct action, with tuple unpacking naturally capturing the sanitized header values. Reading flow: Initialization followed by customized assignment provides a logical progression, although additional blank lines before the class would improve visual separation.