@@ -58,7 +58,9 @@ def _decode_header_lines(lines):
58
58
# Python 3, validate() takes either and returns matches as bytes. But
59
59
# on Python 2, validate can return matches as bytearrays, so we have
60
60
# 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
+ )
62
64
yield (matches ["field_name" ], matches ["field_value" ])
63
65
64
66
@@ -71,7 +73,9 @@ def maybe_read_from_IDLE_client(buf):
71
73
return None
72
74
if not lines :
73
75
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
+ )
75
79
return Request (
76
80
headers = list (_decode_header_lines (lines [1 :])), _parsed = True , ** matches
77
81
)
@@ -152,7 +156,12 @@ def __call__(self, buf):
152
156
chunk_header = buf .maybe_extract_until_next (b"\r \n " )
153
157
if chunk_header is None :
154
158
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
+ )
156
165
# XX FIXME: we discard chunk extensions. Does anyone care?
157
166
# We convert to bytes because Python 2's `int()` function doesn't
158
167
# work properly on bytearray objects.
0 commit comments