mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-13 05:31:43 +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,16 +1,16 @@
|
||||
from _typeshed import AnyPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import IO, Any, AnyStr, Callable, ContextManager, Optional, Text, Type
|
||||
|
||||
def replace_atomic(src: AnyStr, dst: AnyStr) -> None: ...
|
||||
def move_atomic(src: AnyStr, dst: AnyStr) -> None: ...
|
||||
|
||||
class AtomicWriter(object):
|
||||
def __init__(self, path: AnyPath, mode: Text = ..., overwrite: bool = ...) -> None: ...
|
||||
def __init__(self, path: StrOrBytesPath, mode: Text = ..., overwrite: bool = ...) -> None: ...
|
||||
def open(self) -> ContextManager[IO[Any]]: ...
|
||||
def _open(self, get_fileobject: Callable[..., IO[AnyStr]]) -> ContextManager[IO[AnyStr]]: ...
|
||||
def get_fileobject(self, dir: Optional[AnyPath] = ..., **kwargs: Any) -> IO[Any]: ...
|
||||
def get_fileobject(self, dir: Optional[StrOrBytesPath] = ..., **kwargs: Any) -> IO[Any]: ...
|
||||
def sync(self, f: IO[Any]) -> None: ...
|
||||
def commit(self, f: IO[Any]) -> None: ...
|
||||
def rollback(self, f: IO[Any]) -> None: ...
|
||||
|
||||
def atomic_write(path: AnyPath, writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object) -> ContextManager[IO[Any]]: ...
|
||||
def atomic_write(path: StrOrBytesPath, writer_cls: Type[AtomicWriter] = ..., **cls_kwargs: object) -> ContextManager[IO[Any]]: ...
|
||||
|
||||
Reference in New Issue
Block a user