Skip to content

Commit 3f090fb

Browse files
committed
fix multipart.py indentation
1 parent bb5c313 commit 3f090fb

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

pigwig/multipart.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,35 +87,35 @@ def parse_multipart(fp: io.BufferedIOBase, pdict: dict) -> dict[str, list[bytes
8787
return partdict
8888

8989
def parse_header(line: str) -> tuple[str, dict[str, str]]:
90-
"""Parse a Content-type like header.
90+
"""Parse a Content-type like header.
9191
92-
Return the main content-type and a dictionary of options.
93-
"""
94-
parts = _parseparam(';' + line)
95-
key = parts.__next__()
96-
pdict = {}
97-
for p in parts:
98-
i = p.find('=')
99-
if i >= 0:
100-
name = p[:i].strip().lower()
101-
value = p[i+1:].strip()
102-
if len(value) >= 2 and value[0] == value[-1] == '"':
103-
value = value[1:-1]
104-
value = value.replace('\\\\', '\\').replace('\\"', '"')
105-
pdict[name] = value
106-
return key, pdict
92+
Return the main content-type and a dictionary of options.
93+
"""
94+
parts = _parseparam(';' + line)
95+
key = parts.__next__()
96+
pdict = {}
97+
for p in parts:
98+
i = p.find('=')
99+
if i >= 0:
100+
name = p[:i].strip().lower()
101+
value = p[i+1:].strip()
102+
if len(value) >= 2 and value[0] == value[-1] == '"':
103+
value = value[1:-1]
104+
value = value.replace('\\\\', '\\').replace('\\"', '"')
105+
pdict[name] = value
106+
return key, pdict
107107

108108
def _parseparam(s: str) -> typing.Iterator[str]:
109-
while s[:1] == ';':
110-
s = s[1:]
111-
end = s.find(';')
112-
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
113-
end = s.find(';', end + 1)
114-
if end < 0:
115-
end = len(s)
116-
f = s[:end]
117-
yield f.strip()
118-
s = s[end:]
109+
while s[:1] == ';':
110+
s = s[1:]
111+
end = s.find(';')
112+
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
113+
end = s.find(';', end + 1)
114+
if end < 0:
115+
end = len(s)
116+
f = s[:end]
117+
yield f.strip()
118+
s = s[end:]
119119

120120
class MultipartFile:
121121
"""

0 commit comments

Comments
 (0)