@@ -191,9 +191,7 @@ def _read_from_buffer(
191191
192192 def _readinto (self , buf : bytearray ) -> int :
193193 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." )
197195
198196 if not self ._remaining :
199197 # Consume the chunk header if need be.
@@ -280,10 +278,7 @@ def _parse_headers(self) -> None:
280278
281279 def _validate_not_gzip (self ) -> None :
282280 """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" :
287282 raise ValueError (
288283 "Content-encoding is gzip, data cannot be accessed as json or text. "
289284 "Use content property to access raw bytes."
@@ -394,9 +389,7 @@ def _build_boundary_data(self, files: dict): # pylint: disable=too-many-locals
394389 if len (field_values ) >= 4 :
395390 file_headers = field_values [3 ]
396391 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 " )
400393 boundary_objects .append ("\r \n " )
401394
402395 if hasattr (file_handle , "read" ):
@@ -500,7 +493,8 @@ def _send_header(self, socket, header, value):
500493 self ._send_as_bytes (socket , value )
501494 self ._send (socket , b"\r \n " )
502495
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
504498 self ,
505499 socket : SocketType ,
506500 host : str ,
@@ -543,9 +537,7 @@ def _send_request( # noqa: PLR0913 Too many arguments in function definition
543537 data_is_file = False
544538 boundary_objects = None
545539 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 )
549541 content_type_header = f"multipart/form-data; boundary={ boundary_string } "
550542 elif data and hasattr (data , "read" ):
551543 data_is_file = True
@@ -644,9 +636,7 @@ def request( # noqa: PLR0912,PLR0913,PLR0915 Too many branches,Too many argumen
644636 )
645637 ok = True
646638 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 )
650640 except OSError as exc :
651641 last_exc = exc
652642 ok = False
0 commit comments