@@ -751,45 +751,13 @@ async def _request(
751
751
json : data_binding .JSONObjectBuilder | data_binding .JSONArray | None = None ,
752
752
reason : undefined .UndefinedOr [str ] = undefined .UNDEFINED ,
753
753
auth : undefined .UndefinedNoneOr [str ] = undefined .UNDEFINED ,
754
- ) -> None | data_binding .JSONObject | data_binding .JSONArray :
754
+ ) -> data_binding .JSONObject | data_binding .JSONArray | None :
755
+ # Make a ratelimit-protected HTTP request to a JSON endpoint and expect some form
756
+ # of JSON response.
755
757
if not self ._close_event :
756
758
msg = "Cannot use an inactive REST client"
757
759
raise errors .ComponentStateConflictError (msg )
758
760
759
- request_task = asyncio .create_task (
760
- self ._perform_request (
761
- compiled_route = compiled_route ,
762
- query = query ,
763
- form_builder = form_builder ,
764
- json = json ,
765
- reason = reason ,
766
- auth = auth ,
767
- )
768
- )
769
-
770
- await aio .first_completed (request_task , self ._close_event .wait ())
771
-
772
- if not request_task .cancelled ():
773
- return request_task .result ()
774
-
775
- msg = "The REST client was closed mid-request"
776
- raise errors .ComponentStateConflictError (msg )
777
-
778
- # We rather keep everything we can here inline.
779
- @typing .final
780
- async def _perform_request ( # noqa: C901, PLR0912, PLR0915
781
- self ,
782
- compiled_route : routes .CompiledRoute ,
783
- * ,
784
- query : data_binding .StringMapBuilder | None = None ,
785
- form_builder : data_binding .URLEncodedFormBuilder | None = None ,
786
- json : data_binding .JSONObject | data_binding .JSONArray | None = None ,
787
- reason : undefined .UndefinedOr [str ] = undefined .UNDEFINED ,
788
- auth : undefined .UndefinedNoneOr [str ] = undefined .UNDEFINED ,
789
- ) -> None | data_binding .JSONObject | data_binding .JSONArray :
790
- # Make a ratelimit-protected HTTP request to a JSON endpoint and expect some form
791
- # of JSON response.
792
-
793
761
assert self ._client_session is not None # This will never be None here
794
762
795
763
headers = data_binding .StringMapBuilder ()
0 commit comments