Skip to content

Commit 485c232

Browse files
arturhooambv
authored andcommitted
Improve resource stubs for py3 (#1565)
1 parent 1c8f43b commit 485c232

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

stdlib/3/resource.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# NOTE: These are incomplete!
44

5-
from typing import Tuple
5+
from typing import Tuple, Optional, NamedTuple
66

77
RLIMIT_AS = ... # type: int
88
RLIMIT_CORE = ... # type: int
@@ -25,7 +25,17 @@ RUSAGE_CHILDREN = ... # type: int
2525
RUSAGE_SELF = ... # type: int
2626
RUSAGE_THREAD = ... # type: int
2727

28+
_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int),
29+
('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int),
30+
('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int),
31+
('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int),
32+
('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int),
33+
('ru_nivcsw', int)])
34+
35+
def getpagesize() -> int: ...
2836
def getrlimit(resource: int) -> Tuple[int, int]: ...
37+
def getrusage(who: int) -> _RUsage: ...
38+
def prlimit(pid: int, resource: int, limits: Optional[Tuple[int, int]]) -> Tuple[int, int]: ...
2939
def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ...
3040

3141
# NOTE: This is an alias of OSError in Python 3.3.

0 commit comments

Comments
 (0)