@@ -191,9 +191,7 @@ def _read_from_buffer(
191
191
192
192
def _readinto (self , buf : bytearray ) -> int :
193
193
if not self .socket :
194
- raise RuntimeError (
195
- "Newer Response closed this one. Use Responses immediately."
196
- )
194
+ raise RuntimeError ("Newer Response closed this one. Use Responses immediately." )
197
195
198
196
if not self ._remaining :
199
197
# Consume the chunk header if need be.
@@ -280,10 +278,7 @@ def _parse_headers(self) -> None:
280
278
281
279
def _validate_not_gzip (self ) -> None :
282
280
"""gzip encoding is not supported. Raise an exception if found."""
283
- if (
284
- "content-encoding" in self .headers
285
- and self .headers ["content-encoding" ] == "gzip"
286
- ):
281
+ if "content-encoding" in self .headers and self .headers ["content-encoding" ] == "gzip" :
287
282
raise ValueError (
288
283
"Content-encoding is gzip, data cannot be accessed as json or text. "
289
284
"Use content property to access raw bytes."
@@ -394,9 +389,7 @@ def _build_boundary_data(self, files: dict): # pylint: disable=too-many-locals
394
389
if len (field_values ) >= 4 :
395
390
file_headers = field_values [3 ]
396
391
for file_header_key , file_header_value in file_headers .items ():
397
- boundary_objects .append (
398
- f"{ file_header_key } : { file_header_value } \r \n "
399
- )
392
+ boundary_objects .append (f"{ file_header_key } : { file_header_value } \r \n " )
400
393
boundary_objects .append ("\r \n " )
401
394
402
395
if hasattr (file_handle , "read" ):
@@ -500,7 +493,8 @@ def _send_header(self, socket, header, value):
500
493
self ._send_as_bytes (socket , value )
501
494
self ._send (socket , b"\r \n " )
502
495
503
- def _send_request ( # noqa: PLR0913 Too many arguments in function definition
496
+ # noqa: PLR0912 Too many branches
497
+ def _send_request ( # noqa: PLR0913,PLR0912 Too many arguments in function definition,Too many branches
504
498
self ,
505
499
socket : SocketType ,
506
500
host : str ,
@@ -543,9 +537,7 @@ def _send_request( # noqa: PLR0913 Too many arguments in function definition
543
537
data_is_file = False
544
538
boundary_objects = None
545
539
if files and isinstance (files , dict ):
546
- boundary_string , content_length , boundary_objects = (
547
- self ._build_boundary_data (files )
548
- )
540
+ boundary_string , content_length , boundary_objects = self ._build_boundary_data (files )
549
541
content_type_header = f"multipart/form-data; boundary={ boundary_string } "
550
542
elif data and hasattr (data , "read" ):
551
543
data_is_file = True
@@ -644,9 +636,7 @@ def request( # noqa: PLR0912,PLR0913,PLR0915 Too many branches,Too many argumen
644
636
)
645
637
ok = True
646
638
try :
647
- self ._send_request (
648
- socket , host , method , path , headers , data , json , files
649
- )
639
+ self ._send_request (socket , host , method , path , headers , data , json , files )
650
640
except OSError as exc :
651
641
last_exc = exc
652
642
ok = False
0 commit comments