Sample

pyint-f8123eee81c6-SRC

Unmodified source class

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 Pro140–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 shows reasonable structure with clear imports and a simple class hierarchy. However, readability is mixed. The import section is organized but lengthy, with several unused or redundant imports (e.g., email.message, email.policy, BytesIO, StringIO, Path) that add noise. The class definition is concise and the __init__ method has a logical parameter flow, though the use of underscore-prefixed parameters (_subtype, _subparts, **_params) reduces clarity. Action granularity is generally good, with one operation per line. The __setitem__ method is clean but the purpose of forbid_multi_line_headers is not immediately obvious without context. The reading flow is natural for the class portion, but the jump from imports to a single class feels incomplete or truncated. Nesting is flat, which is positive. Overall, the code is maintainable but could benefit from removing unused imports and adding brief docstrings for clarity.

Run 2

The code structure is logical, with clear separation of imports, class definition, and method overrides. Nesting is minimal—flat class structure with straightforward method bodies. Clarity of intent is good: SafeMIMEMultipart clearly extends MIMEMultipart to sanitize multi-line headers. Code length is concise; no unnecessary verbosity. Action granularity is mostly one action per line, though MIMEMultipart.__init__ call packs multiple arguments on one line. Reading flow is natural, progressing from imports to class to methods. Minor deductions: inherited MIMEMixin is mentioned but not shown, which slightly obscures completeness. Also, the __init__ signature uses leading underscores for internal params, which is explicit but may confuse readers unfamiliar with Python's MIME API. Overall, highly readable with room for small clarity improvements.

Run 3

The code shows reasonable organization with clear imports and a single class definition, but readability is hampered by several issues. The import section is verbose and mixes standard library, third-party, and local imports without clear grouping, making it harder to scan. The SafeMIMEMultipart class has a moderate nesting level with a multi-line __init__ signature that includes many parameters, which could be clearer with type hints or better documentation. The __setitem__ method is concise and demonstrates good action granularity with two clear operations per line. However, the class inherits from MIMEMixin (which is not defined in the visible code) creating ambiguity about its complete behavior. The naming is generally clear, but the underscore-prefixed parameters like _subtype and _subparts, while following Python conventions for internal parameters, may confuse readers unfamiliar with MIME internals. Overall the code is functional but would benefit from import grouping, type hints, and better class documentation to improve clarity of intent.

Run 1

Code Structure: Imports and a small class are logically organized, though many imports are unused in this excerpt and a blank line between imports and the class would improve separation. Nesting: Methods are flat, with no complex branching. Clarity of intent: The class name and header-validation call clearly suggest safe MIME handling, although MIMEMixin and forbid_multi_line_headers are defined outside the excerpt. Code length: The class is concise, but the extensive import block outweighs the visible implementation. Action granularity: Each statement performs one clear action. Reading flow: Initialization followed by header assignment is natural, and formatting is consistent; external dependencies and import clutter slightly interrupt comprehension.

Run 2

Code Structure: Imports are grouped coherently, and the class cleanly separates initialization from header assignment, though many imports are unused in this excerpt. Nesting: Methods are flat with no nested control flow. Clarity of intent: SafeMIMEMultipart and forbid_multi_line_headers clearly communicate safe MIME header handling; undefined helpers in the excerpt and abbreviated parameter names slightly reduce self-contained clarity. Code length: The class is concise, but the extensive import section outweighs the implementation shown. Action granularity: Each statement performs a single clear action. Reading flow: Initialization followed by header validation and delegation is natural, with consistent formatting; additional spacing between import groups and before the class would improve visual organization.

Run 3

Code Structure: Imports precede a small, logically organized class, though many imports are unused in this excerpt. Nesting: Methods are flat, with no nested control flow. Clarity of intent: SafeMIMEMultipart and forbid_multi_line_headers clearly suggest header-safety enforcement; however, the undefined MIMEMixin and validation helper require external context, and val is a generic name. Code length: The class is concise, but the extensive import block overwhelms its small implementation. Action granularity: Statements generally perform one clear action per line. Reading flow: Initialization followed by header assignment validation is natural and easy to follow, although explicit parent-class calls are somewhat verbose.