Use imports instead of TypeAliases in a couple places (#7634)

Fixes #7632
This commit is contained in:
Alex Waygood
2022-04-16 09:38:59 +01:00
committed by GitHub
parent 740193a8fc
commit 66bea8ca48
2 changed files with 6 additions and 12 deletions

View File

@@ -2,10 +2,11 @@ import subprocess
import sys
import time
from _typeshed import Self
from builtins import list as _list # conflicts with a method named "list"
from socket import socket as _socket
from ssl import SSLContext, SSLSocket
from types import TracebackType
from typing import IO, Any, Callable, Pattern, TypeVar
from typing import IO, Any, Callable, Pattern
from typing_extensions import Literal, TypeAlias
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"]
@@ -16,9 +17,6 @@ _CommandResults: TypeAlias = tuple[str, list[Any]]
_AnyResponseData: TypeAlias = list[None] | list[bytes | tuple[bytes, bytes]]
_T = TypeVar("_T")
_list: TypeAlias = list[_T] # conflicts with a method named "list"
class IMAP4:
error: type[Exception]
abort: type[Exception]

View File

@@ -1,14 +1,12 @@
from _typeshed import Self, SupportsItems
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, TypeVar, Union
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, Union
from typing_extensions import TypeAlias
from urllib3 import _collections
from urllib3._collections import RecentlyUsedContainer
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, utils
from .models import Response
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
from .structures import CaseInsensitiveDict as CaseInsensitiveDict
_BaseAdapter = adapters.BaseAdapter
OrderedDict = compat.OrderedDict
@@ -28,8 +26,6 @@ TooManyRedirects = exceptions.TooManyRedirects
InvalidSchema = exceptions.InvalidSchema
ChunkedEncodingError = exceptions.ChunkedEncodingError
ContentDecodingError = exceptions.ContentDecodingError
RecentlyUsedContainer: TypeAlias = _collections.RecentlyUsedContainer[_KT, _VT]
CaseInsensitiveDict: TypeAlias = structures.CaseInsensitiveDict[_VT]
HTTPAdapter = adapters.HTTPAdapter
requote_uri = utils.requote_uri
get_environ_proxies = utils.get_environ_proxies