Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 604: Remove some more uses of Union/Optional #7515

Merged
merged 5 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions stdlib/asyncio/trsock.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import socket
import sys
from builtins import type as Type # alias to avoid name clashes with property named "type"
from types import TracebackType
from typing import Any, BinaryIO, Iterable, NoReturn, Union, overload
from typing import Any, BinaryIO, Iterable, NoReturn, overload

# These are based in socket, maybe move them out into _typeshed.pyi or such
_Address = Union[tuple[Any, ...], str]
_Address = tuple[Any, ...] | str
_RetAddress = Any
_WriteBuffer = bytearray | memoryview
_CMSG = tuple[int, int, bytes]
Expand Down
21 changes: 10 additions & 11 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ from typing import (
Protocol,
Sequence,
TypeVar,
Union,
overload,
runtime_checkable,
)
Expand Down Expand Up @@ -832,16 +831,16 @@ def execlpe(file: StrOrBytesPath, __arg0: StrOrBytesPath, *args: Any) -> NoRetur
# Not separating out PathLike[str] and PathLike[bytes] here because it doesn't make much difference
# in practice, and doing so would explode the number of combinations in this already long union.
# All these combinations are necessary due to list being invariant.
_ExecVArgs = Union[
tuple[StrOrBytesPath, ...],
list[bytes],
list[str],
list[PathLike[Any]],
list[bytes | str],
list[bytes | PathLike[Any]],
list[str | PathLike[Any]],
list[bytes | str | PathLike[Any]],
]
_ExecVArgs = (
tuple[StrOrBytesPath, ...]
| list[bytes]
| list[str]
| list[PathLike[Any]]
| list[bytes | str]
| list[bytes | PathLike[Any]]
| list[str | PathLike[Any]]
| list[bytes | str | PathLike[Any]]
)
_ExecEnv = Mapping[bytes, bytes | str] | Mapping[str, bytes | str]

def execv(__path: StrOrBytesPath, __argv: _ExecVArgs) -> NoReturn: ...
Expand Down
8 changes: 5 additions & 3 deletions stdlib/xmlrpc/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class _SupportsTimeTuple(Protocol):
def timetuple(self) -> time.struct_time: ...

_DateTimeComparable = DateTime | datetime | str | _SupportsTimeTuple
_Marshallable = Union[None, bool, int, float, str, bytes, tuple[Any, ...], list[Any], dict[Any, Any], datetime, DateTime, Binary]
_XMLDate = Union[int, datetime, tuple[int, ...], time.struct_time]
_HostType = Union[tuple[str, dict[str, str]], str]
_Marshallable = (
bool | int | float | str | bytes | None | tuple[Any, ...] | list[Any] | dict[Any, Any] | datetime | DateTime | Binary
)
_XMLDate = int | datetime | tuple[int, ...] | time.struct_time
_HostType = Union[str, tuple[str, dict[str, str]]]
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved

def escape(s: str) -> str: ... # undocumented

Expand Down
2 changes: 1 addition & 1 deletion stubs/requests/requests/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SessionRedirectMixin:
def rebuild_proxies(self, prepared_request, proxies): ...
def should_strip_auth(self, old_url, new_url): ...

_Data = Union[None, Text, bytes, Mapping[str, Any], Mapping[Text, Any], Iterable[tuple[Text, Optional[Text]]], IO[Any]]
_Data = Text | bytes | Mapping[str, Any] | Mapping[Text, Any] | Iterable[tuple[Text, Optional[Text]]] | IO[Any] | None

_Hook = Callable[[Response], Any]
_Hooks = MutableMapping[Text, _Hook | list[_Hook]]
Expand Down