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

Commit 04ea048

Browse filesBrowse files
JosephSBoylewarsaw
andauthored
gh-102498 Clean up unused variables and imports in the email module (#102482)
* Clean up unused variables and imports in the email module * Remove extra newline char * Remove superflous dict+unpacking syntax * Remove unused 'msg' var * Clean up unused variables and imports in the email module * Remove extra newline char * Remove superflous dict+unpacking syntax * Remove unused 'msg' var --------- Co-authored-by: Barry Warsaw <barry@python.org>
1 parent 58b6be3 commit 04ea048
Copy full SHA for 04ea048

File tree

5 files changed

+6
-10
lines changed
Filter options

5 files changed

+6
-10
lines changed

‎Lib/email/_header_value_parser.py

Copy file name to clipboardExpand all lines: Lib/email/_header_value_parser.py
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,7 +1987,7 @@ def get_address_list(value):
19871987
try:
19881988
token, value = get_address(value)
19891989
address_list.append(token)
1990-
except errors.HeaderParseError as err:
1990+
except errors.HeaderParseError:
19911991
leader = None
19921992
if value[0] in CFWS_LEADER:
19931993
leader, value = get_cfws(value)
@@ -2096,7 +2096,7 @@ def get_msg_id(value):
20962096
except errors.HeaderParseError:
20972097
try:
20982098
token, value = get_no_fold_literal(value)
2099-
except errors.HeaderParseError as e:
2099+
except errors.HeaderParseError:
21002100
try:
21012101
token, value = get_domain(value)
21022102
msg_id.defects.append(errors.ObsoleteHeaderDefect(
@@ -2443,7 +2443,6 @@ def get_parameter(value):
24432443
raise errors.HeaderParseError("Parameter not followed by '='")
24442444
param.append(ValueTerminal('=', 'parameter-separator'))
24452445
value = value[1:]
2446-
leader = None
24472446
if value and value[0] in CFWS_LEADER:
24482447
token, value = get_cfws(value)
24492448
param.append(token)
@@ -2568,7 +2567,7 @@ def parse_mime_parameters(value):
25682567
try:
25692568
token, value = get_parameter(value)
25702569
mime_parameters.append(token)
2571-
except errors.HeaderParseError as err:
2570+
except errors.HeaderParseError:
25722571
leader = None
25732572
if value[0] in CFWS_LEADER:
25742573
leader, value = get_cfws(value)
@@ -2626,7 +2625,6 @@ def parse_content_type_header(value):
26262625
don't do that.
26272626
"""
26282627
ctype = ContentType()
2629-
recover = False
26302628
if not value:
26312629
ctype.defects.append(errors.HeaderMissingRequiredValue(
26322630
"Missing content type specification"))

‎Lib/email/charset.py

Copy file name to clipboardExpand all lines: Lib/email/charset.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ def header_encode_lines(self, string, maxlengths):
341341
if not lines and not current_line:
342342
lines.append(None)
343343
else:
344-
separator = (' ' if lines else '')
345344
joined_line = EMPTYSTRING.join(current_line)
346345
header_bytes = _encode(joined_line, codec)
347346
lines.append(encoder(header_bytes))

‎Lib/email/feedparser.py

Copy file name to clipboardExpand all lines: Lib/email/feedparser.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _parsegen(self):
264264
yield NeedMoreData
265265
continue
266266
break
267-
msg = self._pop_message()
267+
self._pop_message()
268268
# We need to pop the EOF matcher in order to tell if we're at
269269
# the end of the current file, not the end of the last block
270270
# of message headers.

‎Lib/email/message.py

Copy file name to clipboardExpand all lines: Lib/email/message.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Intrapackage imports
1515
from email import utils
1616
from email import errors
17-
from email._policybase import Policy, compat32
17+
from email._policybase import compat32
1818
from email import charset as _charset
1919
from email._encoded_words import decode_b
2020
Charset = _charset.Charset

‎Lib/email/mime/text.py

Copy file name to clipboardExpand all lines: Lib/email/mime/text.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
__all__ = ['MIMEText']
88

9-
from email.charset import Charset
109
from email.mime.nonmultipart import MIMENonMultipart
1110

1211

@@ -36,6 +35,6 @@ def __init__(self, _text, _subtype='plain', _charset=None, *, policy=None):
3635
_charset = 'utf-8'
3736

3837
MIMENonMultipart.__init__(self, 'text', _subtype, policy=policy,
39-
**{'charset': str(_charset)})
38+
charset=str(_charset))
4039

4140
self.set_payload(_text, _charset)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.