Skip to content

Commit e1340f4

Browse files
tomchristiepgjones
authored andcommitted
Black formatting
1 parent fac1eca commit e1340f4

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

h11/_readers.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def _decode_header_lines(lines):
5858
# Python 3, validate() takes either and returns matches as bytes. But
5959
# on Python 2, validate can return matches as bytearrays, so we have
6060
# to explicitly cast back.
61-
matches = validate(header_field_re, bytes(line), "illegal header line: {!r}", bytes(line))
61+
matches = validate(
62+
header_field_re, bytes(line), "illegal header line: {!r}", bytes(line)
63+
)
6264
yield (matches["field_name"], matches["field_value"])
6365

6466

@@ -71,7 +73,9 @@ def maybe_read_from_IDLE_client(buf):
7173
return None
7274
if not lines:
7375
raise LocalProtocolError("no request line received")
74-
matches = validate(request_line_re, lines[0], "illegal request line: {!r}", lines[0])
76+
matches = validate(
77+
request_line_re, lines[0], "illegal request line: {!r}", lines[0]
78+
)
7579
return Request(
7680
headers=list(_decode_header_lines(lines[1:])), _parsed=True, **matches
7781
)
@@ -152,7 +156,12 @@ def __call__(self, buf):
152156
chunk_header = buf.maybe_extract_until_next(b"\r\n")
153157
if chunk_header is None:
154158
return None
155-
matches = validate(chunk_header_re, chunk_header, "illegal chunk header: {!r}", chunk_header)
159+
matches = validate(
160+
chunk_header_re,
161+
chunk_header,
162+
"illegal chunk header: {!r}",
163+
chunk_header,
164+
)
156165
# XX FIXME: we discard chunk extensions. Does anyone care?
157166
# We convert to bytes because Python 2's `int()` function doesn't
158167
# work properly on bytearray objects.

h11/tests/test_events.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,7 @@ def test_header_casing():
174174
)
175175
assert len(r.headers) == 2
176176
assert r.headers == [(b"host", b"example.org"), (b"connection", b"keep-alive")]
177-
assert r.headers.raw_items() == [(b"Host", b"example.org"), (b"Connection", b"keep-alive")]
177+
assert r.headers.raw_items() == [
178+
(b"Host", b"example.org"),
179+
(b"Connection", b"keep-alive"),
180+
]

0 commit comments

Comments
 (0)