Skip to content

Commit 66bea8c

Browse files
authored
Use imports instead of TypeAliases in a couple places (#7634)
Fixes #7632
1 parent 740193a commit 66bea8c

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

stdlib/imaplib.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import subprocess
22
import sys
33
import time
44
from _typeshed import Self
5+
from builtins import list as _list # conflicts with a method named "list"
56
from socket import socket as _socket
67
from ssl import SSLContext, SSLSocket
78
from types import TracebackType
8-
from typing import IO, Any, Callable, Pattern, TypeVar
9+
from typing import IO, Any, Callable, Pattern
910
from typing_extensions import Literal, TypeAlias
1011

1112
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"]
@@ -16,9 +17,6 @@ _CommandResults: TypeAlias = tuple[str, list[Any]]
1617

1718
_AnyResponseData: TypeAlias = list[None] | list[bytes | tuple[bytes, bytes]]
1819

19-
_T = TypeVar("_T")
20-
_list: TypeAlias = list[_T] # conflicts with a method named "list"
21-
2220
class IMAP4:
2321
error: type[Exception]
2422
abort: type[Exception]

stubs/requests/requests/sessions.pyi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
from _typeshed import Self, SupportsItems
2-
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, TypeVar, Union
2+
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, Union
33
from typing_extensions import TypeAlias
44

5-
from urllib3 import _collections
5+
from urllib3._collections import RecentlyUsedContainer
66

7-
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils
7+
from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, utils
88
from .models import Response
9-
10-
_KT = TypeVar("_KT")
11-
_VT = TypeVar("_VT")
9+
from .structures import CaseInsensitiveDict as CaseInsensitiveDict
1210

1311
_BaseAdapter = adapters.BaseAdapter
1412
OrderedDict = compat.OrderedDict
@@ -28,8 +26,6 @@ TooManyRedirects = exceptions.TooManyRedirects
2826
InvalidSchema = exceptions.InvalidSchema
2927
ChunkedEncodingError = exceptions.ChunkedEncodingError
3028
ContentDecodingError = exceptions.ContentDecodingError
31-
RecentlyUsedContainer: TypeAlias = _collections.RecentlyUsedContainer[_KT, _VT]
32-
CaseInsensitiveDict: TypeAlias = structures.CaseInsensitiveDict[_VT]
3329
HTTPAdapter = adapters.HTTPAdapter
3430
requote_uri = utils.requote_uri
3531
get_environ_proxies = utils.get_environ_proxies

0 commit comments

Comments
 (0)