Define listdir in posix and import it in os. (#3258)

This commit is contained in:
Rebecca Chen
2019-09-23 14:41:05 -07:00
committed by Sebastian Rittau
parent 829c646d69
commit 3f8c2169d1
4 changed files with 27 additions and 24 deletions

View File

@@ -3,7 +3,7 @@
from builtins import OSError as error
from io import TextIOWrapper as _TextIOWrapper
from posix import stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
import sys
from typing import (
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
@@ -200,7 +200,6 @@ def getcwd() -> str: ...
def getcwdu() -> unicode: ...
def chmod(path: _PathType, mode: int) -> None: ...
def link(src: _PathType, link_name: _PathType) -> None: ...
def listdir(path: AnyStr) -> List[AnyStr]: ...
def lstat(path: _PathType) -> Any: ...
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
def major(device: int) -> int: ...

View File

@@ -1,4 +1,4 @@
from typing import Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
from typing import AnyStr, Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
error = OSError
@@ -7,6 +7,8 @@ environ: Dict[str, str]
pathconf_names: Dict[str, int]
sysconf_names: Dict[str, int]
_T = TypeVar("_T")
EX_CANTCREAT: int
EX_CONFIG: int
EX_DATAERR: int
@@ -143,8 +145,7 @@ def kill(pid: int, sig: int) -> None: ...
def killpg(pgid: int, sig: int) -> None: ...
def lchown(path: unicode, uid: int, gid: int) -> None: ...
def link(source: unicode, link_name: str) -> None: ...
_T = TypeVar("_T")
def listdir(path: _T) -> List[_T]: ...
def listdir(path: AnyStr) -> List[AnyStr]: ...
def lseek(fd: int, pos: int, how: int) -> None: ...
def lstat(path: unicode) -> stat_result: ...
def major(device: int) -> int: ...