AnyStr cleanup (#5487)

* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
This commit is contained in:
Sebastian Rittau
2021-05-17 20:45:48 +02:00
committed by GitHub
parent 51b7248154
commit f0bf6eebbd
67 changed files with 546 additions and 529 deletions

View File

@@ -1,4 +1,4 @@
from _typeshed import AnyPath
from _typeshed import StrOrBytesPath
from types import FrameType
from typing import Any, List, Optional
@@ -6,4 +6,4 @@ from . import tasks
def _task_repr_info(task: tasks.Task[Any]) -> List[str]: ... # undocumented
def _task_get_stack(task: tasks.Task[Any], limit: Optional[int]) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: AnyPath) -> None: ... # undocumented
def _task_print_stack(task: tasks.Task[Any], limit: Optional[int], file: StrOrBytesPath) -> None: ... # undocumented

View File

@@ -1,12 +1,12 @@
import subprocess
import sys
from _typeshed import AnyPath
from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from typing import IO, Any, Callable, Optional, Tuple, Union
from typing_extensions import Literal
if sys.version_info >= (3, 8):
_ExecArg = AnyPath
_ExecArg = StrOrBytesPath
else:
_ExecArg = Union[str, bytes]
@@ -56,10 +56,10 @@ if sys.version_info >= (3, 10):
errors: None = ...,
text: Literal[False, None] = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
executable: Optional[AnyPath] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
cwd: Optional[AnyPath] = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...,
@@ -82,10 +82,10 @@ if sys.version_info >= (3, 10):
errors: None = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
text: Optional[bool] = ...,
executable: Optional[AnyPath] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
cwd: Optional[AnyPath] = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...,
@@ -111,10 +111,10 @@ else:
errors: None = ...,
text: Literal[False, None] = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
executable: Optional[AnyPath] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
cwd: Optional[AnyPath] = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...,
@@ -138,10 +138,10 @@ else:
errors: None = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
text: Optional[bool] = ...,
executable: Optional[AnyPath] = ...,
executable: Optional[StrOrBytesPath] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
cwd: Optional[AnyPath] = ...,
cwd: Optional[StrOrBytesPath] = ...,
env: Optional[subprocess._ENV] = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...,