diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index be9cbbda5..e7818420f 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -105,6 +105,20 @@ WNOHANG = 0 # Unix only TMP_MAX = 0 # Undocumented, but used by tempfile # ----- os classes (structures) ----- +if sys.version_info >= (3, 5): + class DirEntry: + # This is what the scandir interator yields + # The constructor is hidden + + name = '' + path = '' + def inode(self) -> int: ... + def is_dir(self, follow_symlinks: bool = ...) -> bool: ... + def is_file(self, follow_symlinks: bool = ...) -> bool: ... + def is_symlink(self) -> bool: ... + def stat(self) -> stat_result: ... + + class stat_result: # For backward compatibility, the return value of stat() is also # accessible as a tuple of at least 10 integers giving the most important @@ -259,6 +273,11 @@ def renames(old: AnyStr, new: AnyStr) -> None: ... if sys.version_info >= (3, 3): def replace(src: AnyStr, dst: AnyStr) -> None: ... def rmdir(path: AnyStr) -> None: ... +if sys.version_info >= (3, 5): + @overload + def scandir(path: str = ...) -> Iterator[DirEntry]: ... + @overload + def scandir(path: bytes) -> Iterator[DirEntry]: ... def stat(path: AnyStr) -> stat_result: ... def stat_float_times(newvalue: Union[bool, None] = ...) -> bool: ... def statvfs(path: str) -> statvfs_result: ... # Unix only