summaryrefslogtreecommitdiff
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/_header_value_parser.py')
-rw-r--r--Lib/email/_header_value_parser.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 5df9511e8d..57d01fbcb0 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -652,8 +652,8 @@ class Comment(WhiteSpaceTokenList):
if value.token_type == 'comment':
return str(value)
return str(value).replace('\\', '\\\\').replace(
- '(', '\(').replace(
- ')', '\)')
+ '(', r'\(').replace(
+ ')', r'\)')
@property
def content(self):
@@ -1356,15 +1356,15 @@ RouteComponentMarker = ValueTerminal('@', 'route-component-marker')
_wsp_splitter = re.compile(r'([{}]+)'.format(''.join(WSP))).split
_non_atom_end_matcher = re.compile(r"[^{}]+".format(
- ''.join(ATOM_ENDS).replace('\\','\\\\').replace(']','\]'))).match
+ ''.join(ATOM_ENDS).replace('\\','\\\\').replace(']',r'\]'))).match
_non_printable_finder = re.compile(r"[\x00-\x20\x7F]").findall
_non_token_end_matcher = re.compile(r"[^{}]+".format(
- ''.join(TOKEN_ENDS).replace('\\','\\\\').replace(']','\]'))).match
+ ''.join(TOKEN_ENDS).replace('\\','\\\\').replace(']',r'\]'))).match
_non_attribute_end_matcher = re.compile(r"[^{}]+".format(
- ''.join(ATTRIBUTE_ENDS).replace('\\','\\\\').replace(']','\]'))).match
+ ''.join(ATTRIBUTE_ENDS).replace('\\','\\\\').replace(']',r'\]'))).match
_non_extended_attribute_end_matcher = re.compile(r"[^{}]+".format(
''.join(EXTENDED_ATTRIBUTE_ENDS).replace(
- '\\','\\\\').replace(']','\]'))).match
+ '\\','\\\\').replace(']',r'\]'))).match
def _validate_xtext(xtext):
"""If input token contains ASCII non-printables, register a defect."""
@@ -1517,7 +1517,7 @@ def get_unstructured(value):
return unstructured
def get_qp_ctext(value):
- """ctext = <printable ascii except \ ( )>
+ r"""ctext = <printable ascii except \ ( )>
This is not the RFC ctext, since we are handling nested comments in comment
and unquoting quoted-pairs here. We allow anything except the '()'
@@ -1878,7 +1878,7 @@ def get_obs_local_part(value):
return obs_local_part, value
def get_dtext(value):
- """ dtext = <printable ascii except \ [ ]> / obs-dtext
+ r""" dtext = <printable ascii except \ [ ]> / obs-dtext
obs-dtext = obs-NO-WS-CTL / quoted-pair
We allow anything except the excluded characters, but if we find any