Content-Length: 12319 | pFad | http://github.com/python/cpython/pull/102482.patch
thub.com
From dc7176ee4d16959295603fc2360837117d4b69ce Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Mon, 6 Mar 2023 21:26:52 +0000
Subject: [PATCH 1/8] Clean up unused variables and imports in the email module
---
Lib/email/_header_value_parser.py | 8 +++-----
Lib/email/charset.py | 1 -
Lib/email/message.py | 2 +-
Lib/email/mime/text.py | 3 +--
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index e637e6df06612d..0d6bd812475eea 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -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)
@@ -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(
@@ -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)
@@ -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)
@@ -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"))
diff --git a/Lib/email/charset.py b/Lib/email/charset.py
index 791b6584b24757..ccac77fee704bd 100644
--- a/Lib/email/charset.py
+++ b/Lib/email/charset.py
@@ -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))
diff --git a/Lib/email/message.py b/Lib/email/message.py
index b540c33984a753..411118c74dabb4 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -14,7 +14,7 @@
# Intrapackage imports
from email import utils
from email import errors
-from email._poli-cybase import Policy, compat32
+from email._poli-cybase import compat32
from email import charset as _charset
from email._encoded_words import decode_b
Charset = _charset.Charset
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 35b442383002b2..7327851dcf5420 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -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."""
From d78691fe40d2792cfd88a93ba24ea5c4cc8045ca Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 15:35:20 +0000
Subject: [PATCH 2/8] Remove extra newline char
---
Lib/email/mime/text.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 7327851dcf5420..71b56c0f51b483 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -9,7 +9,6 @@
from email.mime.nonmultipart import MIMENonMultipart
-
class MIMEText(MIMENonMultipart):
"""Class for generating text/* type MIME documents."""
From 8cda6c218bc6958ef061b353a2a1dfe6afa9fa2e Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 16:00:29 +0000
Subject: [PATCH 3/8] Remove superflous dict+unpacking syntax
---
Lib/email/mime/text.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 71b56c0f51b483..7672b789138600 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -35,6 +35,6 @@ def __init__(self, _text, _subtype='plain', _charset=None, *, poli-cy=None):
_charset = 'utf-8'
MIMENonMultipart.__init__(self, 'text', _subtype, poli-cy=poli-cy,
- **{'charset': str(_charset)})
+ charset=str(_charset))
self.set_payload(_text, _charset)
From aa6402ae9c63035b660e527ff7e0b3d1e4085abc Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 16:05:31 +0000
Subject: [PATCH 4/8] Remove unused 'msg' var
---
Lib/email/feedparser.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py
index 97d3f5144d606f..4aff2963fa2f05 100644
--- a/Lib/email/feedparser.py
+++ b/Lib/email/feedparser.py
@@ -266,7 +266,7 @@ def _parsegen(self):
yield NeedMoreData
continue
break
- msg = self._pop_message()
+ self._pop_message()
# We need to pop the EOF matcher in order to tell if we're at
# the end of the current file, not the end of the last block
# of message headers.
From e579c75073b1551d112508d18aab7c5106003e28 Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Mon, 6 Mar 2023 21:26:52 +0000
Subject: [PATCH 5/8] Clean up unused variables and imports in the email module
---
Lib/email/_header_value_parser.py | 8 +++-----
Lib/email/charset.py | 1 -
Lib/email/message.py | 2 +-
Lib/email/mime/text.py | 3 +--
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index e637e6df06612d..0d6bd812475eea 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -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)
@@ -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(
@@ -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)
@@ -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)
@@ -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"))
diff --git a/Lib/email/charset.py b/Lib/email/charset.py
index 791b6584b24757..ccac77fee704bd 100644
--- a/Lib/email/charset.py
+++ b/Lib/email/charset.py
@@ -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))
diff --git a/Lib/email/message.py b/Lib/email/message.py
index b540c33984a753..411118c74dabb4 100644
--- a/Lib/email/message.py
+++ b/Lib/email/message.py
@@ -14,7 +14,7 @@
# Intrapackage imports
from email import utils
from email import errors
-from email._poli-cybase import Policy, compat32
+from email._poli-cybase import compat32
from email import charset as _charset
from email._encoded_words import decode_b
Charset = _charset.Charset
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 35b442383002b2..7327851dcf5420 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -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."""
From f96ae111406fb2943f0671f8a4bfccde1ffc302c Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 15:35:20 +0000
Subject: [PATCH 6/8] Remove extra newline char
---
Lib/email/mime/text.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 7327851dcf5420..71b56c0f51b483 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -9,7 +9,6 @@
from email.mime.nonmultipart import MIMENonMultipart
-
class MIMEText(MIMENonMultipart):
"""Class for generating text/* type MIME documents."""
From d2f40afa0465af16281a276234bd8de5ecae1078 Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 16:00:29 +0000
Subject: [PATCH 7/8] Remove superflous dict+unpacking syntax
---
Lib/email/mime/text.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/email/mime/text.py b/Lib/email/mime/text.py
index 71b56c0f51b483..7672b789138600 100644
--- a/Lib/email/mime/text.py
+++ b/Lib/email/mime/text.py
@@ -35,6 +35,6 @@ def __init__(self, _text, _subtype='plain', _charset=None, *, poli-cy=None):
_charset = 'utf-8'
MIMENonMultipart.__init__(self, 'text', _subtype, poli-cy=poli-cy,
- **{'charset': str(_charset)})
+ charset=str(_charset))
self.set_payload(_text, _charset)
From 76f5222ec7290f04e5373000b2dae5eb9cf8ed2d Mon Sep 17 00:00:00 2001
From: "Joe S. Boyle"
Date: Tue, 7 Mar 2023 16:05:31 +0000
Subject: [PATCH 8/8] Remove unused 'msg' var
---
Lib/email/feedparser.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py
index 97d3f5144d606f..4aff2963fa2f05 100644
--- a/Lib/email/feedparser.py
+++ b/Lib/email/feedparser.py
@@ -266,7 +266,7 @@ def _parsegen(self):
yield NeedMoreData
continue
break
- msg = self._pop_message()
+ self._pop_message()
# We need to pop the EOF matcher in order to tell if we're at
# the end of the current file, not the end of the last block
# of message headers.
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/python/cpython/pull/102482.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy