mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Fixed a few problems with pathlib2 stub (#5037)
It was using a type alias with a forward definition and a bunch of unused imports. Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
import os
|
||||
import sys
|
||||
from _typeshed import OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, Generator, List, Optional, Sequence, Text, TextIO, Tuple, Type, TypeVar, Union, overload
|
||||
from typing_extensions import Literal
|
||||
from typing import IO, Any, Generator, List, Optional, Sequence, Text, Tuple, Type, TypeVar, Union
|
||||
|
||||
_P = TypeVar("_P", bound=PurePath)
|
||||
|
||||
_PurePathBase = object
|
||||
_PathLike = PurePath
|
||||
|
||||
class PurePath(_PurePathBase):
|
||||
parts: Tuple[str, ...]
|
||||
@@ -20,14 +15,14 @@ class PurePath(_PurePathBase):
|
||||
suffix: str
|
||||
suffixes: List[str]
|
||||
stem: str
|
||||
def __new__(cls: Type[_P], *args: Union[str, _PathLike]) -> _P: ...
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath]) -> _P: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __lt__(self, other: PurePath) -> bool: ...
|
||||
def __le__(self, other: PurePath) -> bool: ...
|
||||
def __gt__(self, other: PurePath) -> bool: ...
|
||||
def __ge__(self, other: PurePath) -> bool: ...
|
||||
def __truediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
def __rtruediv__(self: _P, key: Union[str, _PathLike]) -> _P: ...
|
||||
def __truediv__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __rtruediv__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __div__(self: _P, key: Union[str, PurePath]) -> _P: ...
|
||||
def __bytes__(self) -> bytes: ...
|
||||
def as_posix(self) -> str: ...
|
||||
@@ -35,10 +30,10 @@ class PurePath(_PurePathBase):
|
||||
def is_absolute(self) -> bool: ...
|
||||
def is_reserved(self) -> bool: ...
|
||||
def match(self, path_pattern: str) -> bool: ...
|
||||
def relative_to(self: _P, *other: Union[str, _PathLike]) -> _P: ...
|
||||
def relative_to(self: _P, *other: Union[str, PurePath]) -> _P: ...
|
||||
def with_name(self: _P, name: str) -> _P: ...
|
||||
def with_suffix(self: _P, suffix: str) -> _P: ...
|
||||
def joinpath(self: _P, *other: Union[str, _PathLike]) -> _P: ...
|
||||
def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
|
||||
@property
|
||||
def parents(self: _P) -> Sequence[_P]: ...
|
||||
@property
|
||||
@@ -48,7 +43,7 @@ class PurePosixPath(PurePath): ...
|
||||
class PureWindowsPath(PurePath): ...
|
||||
|
||||
class Path(PurePath):
|
||||
def __new__(cls: Type[_P], *args: Union[str, _PathLike], **kwargs: Any) -> _P: ...
|
||||
def __new__(cls: Type[_P], *args: Union[str, PurePath], **kwargs: Any) -> _P: ...
|
||||
def __enter__(self) -> Path: ...
|
||||
def __exit__(
|
||||
self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[TracebackType]
|
||||
|
||||
Reference in New Issue
Block a user