Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-102498 Clean up unused variables and imports in the email module #102482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up unused variables and imports in the email module
  • Loading branch information
JosephSBoyle committed Mar 8, 2023
commit e579c75073b1551d112508d18aab7c5106003e28
8 changes: 3 additions & 5 deletions 8 Lib/email/_header_value_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,7 @@ def get_address_list(value):
try:
token, value = get_address(value)
address_list.append(token)
except errors.HeaderParseError as err:
except errors.HeaderParseError:
leader = None
if value[0] in CFWS_LEADER:
leader, value = get_cfws(value)
Expand Down Expand Up @@ -2096,7 +2096,7 @@ def get_msg_id(value):
except errors.HeaderParseError:
try:
token, value = get_no_fold_literal(value)
except errors.HeaderParseError as e:
except errors.HeaderParseError:
try:
token, value = get_domain(value)
msg_id.defects.append(errors.ObsoleteHeaderDefect(
Expand Down Expand Up @@ -2443,7 +2443,6 @@ def get_parameter(value):
raise errors.HeaderParseError("Parameter not followed by '='")
param.append(ValueTerminal('=', 'parameter-separator'))
value = value[1:]
leader = None
if value and value[0] in CFWS_LEADER:
token, value = get_cfws(value)
param.append(token)
Expand Down Expand Up @@ -2568,7 +2567,7 @@ def parse_mime_parameters(value):
try:
token, value = get_parameter(value)
mime_parameters.append(token)
except errors.HeaderParseError as err:
except errors.HeaderParseError:
leader = None
if value[0] in CFWS_LEADER:
leader, value = get_cfws(value)
Expand Down Expand Up @@ -2626,7 +2625,6 @@ def parse_content_type_header(value):
don't do that.
"""
ctype = ContentType()
recover = False
if not value:
ctype.defects.append(errors.HeaderMissingRequiredValue(
"Missing content type specification"))
Expand Down
1 change: 0 additions & 1 deletion 1 Lib/email/charset.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ def header_encode_lines(self, string, maxlengths):
if not lines and not current_line:
lines.append(None)
else:
separator = (' ' if lines else '')
joined_line = EMPTYSTRING.join(current_line)
header_bytes = _encode(joined_line, codec)
lines.append(encoder(header_bytes))
Expand Down
2 changes: 1 addition & 1 deletion 2 Lib/email/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Intrapackage imports
from email import utils
from email import errors
from email._policybase import Policy, compat32
from email._policybase import compat32
from email import charset as _charset
from email._encoded_words import decode_b
Charset = _charset.Charset
Expand Down
3 changes: 1 addition & 2 deletions 3 Lib/email/mime/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

__all__ = ['MIMEText']

from email.charset import Charset
from email.mime.nonmultipart import MIMENonMultipart



class MIMEText(MIMENonMultipart):
"""Class for generating text/* type MIME documents."""

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.