Useless linter complaints.
This commit is contained in:
parent
17bdc3db52
commit
ab3d59a74f
|
@ -1,17 +1,17 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
token, quoted = r"([\w!#$%&'*+\-.^_`|~]+)", r'"((?:[^"]|\\")*)"'
|
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):
|
def parse_options_header(value: str):
|
||||||
"""Parse HTTP header values of Content-Type format."""
|
"""Parse HTTP header values of Content-Type format."""
|
||||||
pos = value.find(';')
|
pos = value.find(";")
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
options = {}
|
options = {}
|
||||||
else:
|
else:
|
||||||
options = {
|
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:])
|
for m in parameter.finditer(value[pos:])
|
||||||
}
|
}
|
||||||
value = value[:pos]
|
value = value[:pos]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user