File tree Expand file tree Collapse file tree 5 files changed +39
-11
lines changed Expand file tree Collapse file tree 5 files changed +39
-11
lines changed Original file line number Diff line number Diff line change 11import ssl
22from typing import Any , Optional
3+ import warnings
34
45import anyio
56
@@ -52,6 +53,12 @@ async def connect(
5253 timeout = DEFAULT_TIMEOUT
5354
5455 _stream = kwargs .get ('_stream' )
56+ if _stream is not None :
57+ warnings .warn (
58+ "The '_stream' argument is deprecated and will be removed in the future" ,
59+ DeprecationWarning ,
60+ stacklevel = 2 ,
61+ )
5562
5663 try :
5764 with anyio .fail_after (timeout ):
Original file line number Diff line number Diff line change 22import socket
33import sys
44from typing import Any , Optional
5+ import warnings
56
67from ..._types import ProxyType
78from ..._helpers import parse_proxy_url
@@ -58,6 +59,13 @@ async def connect(
5859 timeout = DEFAULT_TIMEOUT
5960
6061 _socket = kwargs .get ('_socket' )
62+ if _socket is not None :
63+ warnings .warn (
64+ "The '_socket' argument is deprecated and will be removed in the future" ,
65+ DeprecationWarning ,
66+ stacklevel = 2 ,
67+ )
68+
6169 try :
6270 async with async_timeout .timeout (timeout ):
6371 return await self ._connect (
@@ -131,11 +139,7 @@ def is_uvloop_event_loop():
131139 return False
132140 return isinstance (self ._loop , Loop )
133141
134- return (
135- sys .version_info [:2 ] >= (3 , 8 )
136- or is_proactor_event_loop ()
137- or is_uvloop_event_loop ()
138- )
142+ return sys .version_info [:2 ] >= (3 , 8 ) or is_proactor_event_loop () or is_uvloop_event_loop ()
139143
140144 @property
141145 def proxy_host (self ):
Original file line number Diff line number Diff line change 11from typing import Any , Optional
2+ import warnings
23import curio
34import curio .io
45
@@ -47,6 +48,12 @@ async def connect(
4748 timeout = DEFAULT_TIMEOUT
4849
4950 _socket = kwargs .get ('_socket' )
51+ if _socket is not None :
52+ warnings .warn (
53+ "The '_socket' argument is deprecated and will be removed in the future" ,
54+ DeprecationWarning ,
55+ stacklevel = 2 ,
56+ )
5057
5158 try :
5259 return await curio .timeout_after (
Original file line number Diff line number Diff line change 11from typing import Any , Optional
2+ import warnings
23import trio
34
45from ..._types import ProxyType
@@ -46,6 +47,12 @@ async def connect(
4647 timeout = DEFAULT_TIMEOUT
4748
4849 _socket = kwargs .get ('_socket' )
50+ if _socket is not None :
51+ warnings .warn (
52+ "The '_socket' argument is deprecated and will be removed in the future" ,
53+ DeprecationWarning ,
54+ stacklevel = 2 ,
55+ )
4956
5057 try :
5158 with trio .fail_after (timeout ):
@@ -55,9 +62,7 @@ async def connect(
5562 _socket = _socket ,
5663 )
5764 except trio .TooSlowError as e :
58- raise ProxyTimeoutError (
59- 'Proxy connection timed out: {}' .format (timeout )
60- ) from e
65+ raise ProxyTimeoutError ('Proxy connection timed out: {}' .format (timeout )) from e
6166
6267 async def _connect (
6368 self ,
Original file line number Diff line number Diff line change 11import socket
22from typing import Optional , Any
3+ import warnings
34
45from .._errors import ProxyConnectionError , ProxyTimeoutError , ProxyError
56
@@ -46,6 +47,12 @@ def connect(
4647 timeout = DEFAULT_TIMEOUT
4748
4849 _socket = kwargs .get ('_socket' )
50+ if _socket is not None :
51+ warnings .warn (
52+ "The '_socket' argument is deprecated and will be removed in the future" ,
53+ DeprecationWarning ,
54+ stacklevel = 2 ,
55+ )
4956
5057 if _socket is None :
5158 try :
@@ -81,9 +88,7 @@ def connect(
8188 return _socket
8289 except socket .timeout as e :
8390 stream .close ()
84- raise ProxyTimeoutError (
85- 'Proxy connection timed out: {}' .format (timeout )
86- ) from e
91+ raise ProxyTimeoutError ('Proxy connection timed out: {}' .format (timeout )) from e
8792 except ReplyError as e :
8893 stream .close ()
8994 raise ProxyError (e , error_code = e .error_code )
You can’t perform that action at this time.
0 commit comments