11import datetime
2- import ipaddress
2+ from ipaddress import IPv4Address , IPv6Address
33from typing import (
44 AsyncGenerator ,
55 Generator ,
66 Optional ,
77 Tuple ,
88 Any ,
99 Dict ,
10- List ,
10+ Sequence ,
1111 TypedDict ,
1212 Unpack ,
1313 NotRequired ,
@@ -101,7 +101,7 @@ class SocketAddr:
101101 """
102102
103103 def __str__ (self ) -> str : ...
104- def ip (self ) -> ipaddress . IPv4Address | ipaddress . IPv6Address :
104+ def ip (self ) -> IPv4Address | IPv6Address :
105105 r"""
106106 Returns the IP address of the socket address.
107107 """
@@ -446,7 +446,7 @@ class Response:
446446 Get the headers of the response.
447447 """
448448
449- cookies : List [Cookie ]
449+ cookies : Sequence [Cookie ]
450450 r"""
451451 Get the cookies of the response.
452452 """
@@ -466,7 +466,7 @@ class Response:
466466 Get the local address of the response.
467467 """
468468
469- history : List [History ]
469+ history : Sequence [History ]
470470 r"""
471471 Get the redirect history of the Response.
472472 """
@@ -536,7 +536,7 @@ class WebSocket:
536536 Get the headers of the response.
537537 """
538538
539- cookies : List [Cookie ]
539+ cookies : Sequence [Cookie ]
540540 r"""
541541 Get the cookies of the response.
542542 """
@@ -563,7 +563,7 @@ class WebSocket:
563563 Send a message to the WebSocket.
564564 """
565565
566- async def send_all (self , messages : List [Message ]) -> None :
566+ async def send_all (self , messages : Sequence [Message ]) -> None :
567567 r"""
568568 Send multiple messages to the WebSocket.
569569 """
@@ -594,7 +594,7 @@ class ClientParams(TypedDict):
594594 Default request headers.
595595 """
596596
597- orig_headers : NotRequired [List [str ] | OrigHeaderMap ]
597+ orig_headers : NotRequired [Sequence [str ] | OrigHeaderMap ]
598598 """
599599 Original request headers (case-sensitive and order).
600600 """
@@ -771,12 +771,12 @@ class ClientParams(TypedDict):
771771 Disable proxy.
772772 """
773773
774- proxies : NotRequired [List [Proxy ]]
774+ proxies : NotRequired [Sequence [Proxy ]]
775775 """
776776 Proxy server list.
777777 """
778778
779- local_address : NotRequired [str | ipaddress . IPv4Address | ipaddress . IPv6Address ]
779+ local_address : NotRequired [str | IPv4Address | IPv6Address ]
780780 """
781781 Local bind address.
782782 """
@@ -823,7 +823,7 @@ class Request(TypedDict):
823823 The proxy to use for the request.
824824 """
825825
826- local_address : NotRequired [ipaddress . IPv4Address | ipaddress . IPv6Address ]
826+ local_address : NotRequired [IPv4Address | IPv6Address ]
827827 """
828828 Bind to a local IP Address.
829829 """
@@ -853,7 +853,7 @@ class Request(TypedDict):
853853 The headers to use for the request.
854854 """
855855
856- orig_headers : NotRequired [List [str ] | OrigHeaderMap ]
856+ orig_headers : NotRequired [Sequence [str ] | OrigHeaderMap ]
857857 """
858858 The original headers to use for the request.
859859 """
@@ -913,12 +913,12 @@ class Request(TypedDict):
913913 The basic authentication to use for the request.
914914 """
915915
916- query : NotRequired [List [Tuple [str , str ]] | Dict [str , str ]]
916+ query : NotRequired [Sequence [Tuple [str , str ]] | Dict [str , str ]]
917917 """
918918 The query parameters to use for the request.
919919 """
920920
921- form : NotRequired [List [Tuple [str , str ]] | Dict [str , str ]]
921+ form : NotRequired [Sequence [Tuple [str , str ]] | Dict [str , str ]]
922922 """
923923 The form parameters to use for the request.
924924 """
@@ -931,9 +931,9 @@ class Request(TypedDict):
931931 body : NotRequired [
932932 str
933933 | bytes
934- | list [ tuple [str , str ]]
935- | dict [str , str ]
936- | dict [str , Any ]
934+ | Sequence [ Tuple [str , str ]]
935+ | Dict [str , str ]
936+ | Dict [str , Any ]
937937 | Generator [bytes , str , None ]
938938 | AsyncGenerator [bytes , str ]
939939 ]
@@ -957,7 +957,7 @@ class WebSocketRequest(TypedDict):
957957 The proxy to use for the request.
958958 """
959959
960- local_address : NotRequired [str | ipaddress . IPv4Address | ipaddress . IPv6Address ]
960+ local_address : NotRequired [str | IPv4Address | IPv6Address ]
961961 """
962962 Bind to a local IP Address.
963963 """
@@ -972,7 +972,7 @@ class WebSocketRequest(TypedDict):
972972 The headers to use for the request.
973973 """
974974
975- orig_headers : NotRequired [List [str ] | OrigHeaderMap ]
975+ orig_headers : NotRequired [Sequence [str ] | OrigHeaderMap ]
976976 """
977977 The original headers to use for the request.
978978 """
@@ -987,7 +987,7 @@ class WebSocketRequest(TypedDict):
987987 The cookies to use for the request.
988988 """
989989
990- protocols : NotRequired [List [str ]]
990+ protocols : NotRequired [Sequence [str ]]
991991 """
992992 The protocols to use for the request.
993993 """
@@ -1012,7 +1012,7 @@ class WebSocketRequest(TypedDict):
10121012 The basic authentication to use for the request.
10131013 """
10141014
1015- query : NotRequired [List [Tuple [str , str ]]]
1015+ query : NotRequired [Sequence [Tuple [str , str ]]]
10161016 """
10171017 The query parameters to use for the request.
10181018 """
0 commit comments