Useless linter complaints.

This commit is contained in:
L. Kärkkäinen 2019-07-29 19:29:01 +03:00
parent 17bdc3db52
commit ab3d59a74f

View File

@ -1,17 +1,17 @@
import re
token, quoted = r"([\w!#$%&'*+\-.^_`|~]+)", r'"((?:[^"]|\\")*)"'
parameter = re.compile(fr';\s*{token}=(?:{token}|{quoted})', re.ASCII)
parameter = re.compile(fr";\s*{token}=(?:{token}|{quoted})", re.ASCII)
def parse_options_header(value: str):
"""Parse HTTP header values of Content-Type format."""
pos = value.find(';')
pos = value.find(";")
if pos == -1:
options = {}
else:
options = {
m.group(1).lower(): m.group(2) or m.group(3).replace(r'\"', '"')
m.group(1).lower(): m.group(2) or m.group(3).replace('\\"', '"')
for m in parameter.finditer(value[pos:])
}
value = value[:pos]