Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions stdlib/3/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@ if sys.version_info >= (3, 6):
from builtins import _PathLike as PathLike # See comment in builtins

_PathType = path._PathType
if sys.version_info >= (3, 3):
_FdOrPathType = Union[int, _PathType]
else:
_FdOrPathType = _PathType
_FdOrPathType = path._FdOrPathType

if sys.version_info >= (3, 6):
class DirEntry(PathLike[AnyStr]):
Expand Down
21 changes: 13 additions & 8 deletions stdlib/3/os/path.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if sys.version_info >= (3, 6):
else:
_PathType = Union[bytes, Text]

if sys.version_info >= (3, 3):
_FdOrPathType = Union[int, _PathType]
else:
_FdOrPathType = _PathType

# ----- os.path variables -----
supports_unicode_filenames = False
# aliases (also in os)
Expand All @@ -42,21 +47,21 @@ if sys.version_info >= (3, 5):
def commonprefix(list: Sequence[AnyStr]) -> Any: ...

def dirname(path: AnyStr) -> AnyStr: ...
def exists(path: _PathType) -> bool: ...
def exists(path: _FdOrPathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
def expanduser(path: AnyStr) -> AnyStr: ...
def expandvars(path: AnyStr) -> AnyStr: ...

# These return float if os.stat_float_times() == True,
# but int is a subclass of float.
def getatime(path: _PathType) -> float: ...
def getmtime(path: _PathType) -> float: ...
def getctime(path: _PathType) -> float: ...
def getatime(path: _FdOrPathType) -> float: ...
def getmtime(path: _FdOrPathType) -> float: ...
def getctime(path: _FdOrPathType) -> float: ...

def getsize(path: _PathType) -> int: ...
def getsize(path: _FdOrPathType) -> int: ...
def isabs(path: _PathType) -> bool: ...
def isfile(path: _PathType) -> bool: ...
def isdir(path: _PathType) -> bool: ...
def isfile(path: _FdOrPathType) -> bool: ...
def isdir(path: _FdOrPathType) -> bool: ...
def islink(path: _PathType) -> bool: ...
def ismount(path: _PathType) -> bool: ...

Expand Down Expand Up @@ -86,7 +91,7 @@ else:
def realpath(filename: AnyStr) -> AnyStr: ...
def relpath(path: AnyStr, start: _PathType = ...) -> AnyStr: ...

def samefile(path1: _PathType, path2: _PathType) -> bool: ...
def samefile(path1: _FdOrPathType, path2: _FdOrPathType) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
# TODO
# def samestat(stat1: stat_result,
Expand Down