mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
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:
@@ -1,13 +1,12 @@
|
||||
from _typeshed import AnyPath
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Union
|
||||
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator, Text, Union
|
||||
|
||||
def input(
|
||||
files: Union[AnyPath, Iterable[AnyPath], None] = ...,
|
||||
files: Union[Text, Iterable[Text], None] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
|
||||
) -> FileInput[AnyStr]: ...
|
||||
def close() -> None: ...
|
||||
def nextfile() -> None: ...
|
||||
@@ -21,12 +20,12 @@ def isstdin() -> bool: ...
|
||||
class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def __init__(
|
||||
self,
|
||||
files: Union[None, AnyPath, Iterable[AnyPath]] = ...,
|
||||
files: Union[None, Text, Iterable[Text]] = ...,
|
||||
inplace: bool = ...,
|
||||
backup: str = ...,
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[AnyPath, str], IO[AnyStr]] = ...,
|
||||
openhook: Callable[[Text, str], IO[AnyStr]] = ...,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -42,5 +41,5 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
def isfirstline(self) -> bool: ...
|
||||
def isstdin(self) -> bool: ...
|
||||
|
||||
def hook_compressed(filename: AnyPath, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str) -> Callable[[AnyPath, str], IO[Any]]: ...
|
||||
def hook_compressed(filename: Text, mode: str) -> IO[Any]: ...
|
||||
def hook_encoded(encoding: str) -> Callable[[Text, str], IO[Any]]: ...
|
||||
|
||||
Reference in New Issue
Block a user