Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions stdlib/imaplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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]
Expand Down
12 changes: 4 additions & 8 deletions stubs/requests/requests/sessions.pyi
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from urllib3._collections import RecentlyUsedContainer
from urllib3._collections import RecentlyUsedContainer as RecentlyUsedContainer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that initially, but stubtest called me out. Turns out that it doesn't actually exist at runtime, we just use it for annotations in the stub. Not sure why stubtest didn't flag it before now.

Source: https://github.com/psf/requests/blob/main/requests/sessions.py

Stubtest: https://github.com/python/typeshed/runs/6046468647?check_suite_focus=true

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting. stubtest's checking of type aliases is a little loose, see https://github.com/python/mypy/blob/ce858a6a0c85206ff877faf702293a9b67fae750/mypy/stubtest.py#L960 (I don't quite remember why I did it this way, maybe worth reinvestigating)


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
Expand All @@ -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
Expand Down