|
7 | 7 | import itertools |
8 | 8 | import logging |
9 | 9 | from dataclasses import dataclass, field, replace |
10 | | -from typing import Any, Callable, Generator, Mapping |
| 10 | +from typing import TYPE_CHECKING, Any, Callable, Generator, Mapping |
11 | 11 |
|
12 | 12 | from .compat import urlparse |
13 | 13 | from .proxy import get_proxy_url |
|
20 | 20 | from .vendored.urllib3.poolmanager import ProxyManager |
21 | 21 | from .vendored.urllib3.util.url import parse_url |
22 | 22 |
|
| 23 | +if TYPE_CHECKING: |
| 24 | + from .vendored.urllib3.connectionpool import HTTPConnectionPool, HTTPSConnectionPool |
| 25 | + |
23 | 26 | logger = logging.getLogger(__name__) |
24 | 27 | REQUESTS_RETRY = 1 # requests library builtin retry |
25 | 28 |
|
@@ -56,7 +59,9 @@ def wrapper(self, *args, **kwargs): |
56 | 59 | class ProxySupportAdapter(HTTPAdapter): |
57 | 60 | """This Adapter creates proper headers for Proxy CONNECT messages.""" |
58 | 61 |
|
59 | | - def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None): |
| 62 | + def get_connection_with_tls_context( |
| 63 | + self, request, verify, proxies=None, cert=None |
| 64 | + ) -> HTTPConnectionPool | HTTPSConnectionPool: |
60 | 65 | proxy = select_proxy(request.url, proxies) |
61 | 66 | try: |
62 | 67 | host_params, pool_kwargs = self.build_connection_pool_key_attributes( |
|
0 commit comments