Add stub for statvfs and type for fstatvfs (2.7) (#311)

Use the same approach as for resource: define a private NamedTuple
to represent the return value that can be addressed by name or by
sequence.
This commit is contained in:
Russ Allbery
2016-06-23 17:39:06 -07:00
committed by Guido van Rossum
parent 0c26482488
commit 9f3d84551d

View File

@@ -1,7 +1,8 @@
# created from https://docs.python.org/2/library/os.html
from typing import (
List, Tuple, Union, Sequence, Mapping, IO, Any, Optional, AnyStr, Iterator, MutableMapping
List, Tuple, Union, Sequence, Mapping, IO, Any, Optional, AnyStr, Iterator,
MutableMapping, NamedTuple
)
import os.path as path
@@ -76,7 +77,6 @@ def fpathconf(fd: int, name: str) -> None: ...
# TODO(prvak)
def fstat(fd: int) -> Any: ...
def fstatvfs(fd: int) -> Any: ...
def fsync(fd: int) -> None: ...
def ftruncate(fd: int, length: int) -> None: ...
def isatty(fd: int) -> bool: ...
@@ -140,7 +140,15 @@ def rmdir(path: unicode) -> None: ...
# TODO(MichalPokorny)
def stat(path: unicode) -> Any: ...
# TODO: stat_float_times, statvfs, tempnam, tmpnam, TMP_MAX
_StatVFS = NamedTuple('_StatVFS', [('f_bsize', int), ('f_frsize', int), ('f_blocks', int),
('f_bfree', int), ('f_bavail', int), ('f_files', int),
('f_ffree', int), ('f_favail', int), ('f_flag', int),
('f_namemax', int)])
def fstatvfs(fd: int) -> _StatVFS: ...
def statvfs(path: unicode) -> _StatVFS: ...
# TODO: stat_float_times, tempnam, tmpnam, TMP_MAX
def walk(top: AnyStr, topdown: bool = ..., onerror: Any = ...,
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
List[AnyStr]]]: ...