mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
PEP 604: Remove some more uses of Union/Optional (#7515)
The following patterns still break mypy: 1. `type[]` at top level fails 2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine) 3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9 This PR cleans up usage of `Union` and `Optional` outside these patterns.
This commit is contained in:
@@ -32,7 +32,6 @@ from typing import (
|
||||
Protocol,
|
||||
Sequence,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
runtime_checkable,
|
||||
)
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user