resource: various fixes (#3747)

* resource: mark positional-only args
* resource: alias error to OSError
* resource: no longer seems incomplete

At least for Linux and Mac. Might be some things missing for FreeBSD

* resource: fix platform availability
* resource: update whitelist
This commit is contained in:
Shantanu
2020-02-21 02:57:07 -08:00
committed by GitHub
parent a19caac361
commit 374992bff7
2 changed files with 15 additions and 18 deletions

View File

@@ -1,7 +1,6 @@
# Stubs for resource
# NOTE: These are incomplete!
import sys
from typing import Tuple, Optional, NamedTuple
RLIMIT_AS: int
@@ -10,20 +9,21 @@ RLIMIT_CPU: int
RLIMIT_DATA: int
RLIMIT_FSIZE: int
RLIMIT_MEMLOCK: int
RLIMIT_MSGQUEUE: int
RLIMIT_NICE: int
RLIMIT_NOFILE: int
RLIMIT_NPROC: int
RLIMIT_OFILE: int
RLIMIT_RSS: int
RLIMIT_RTPRIO: int
RLIMIT_RTTIME: int
RLIMIT_SIGPENDING: int
RLIMIT_STACK: int
RLIM_INFINITY: int
RUSAGE_CHILDREN: int
RUSAGE_SELF: int
RUSAGE_THREAD: int
if sys.platform == "linux":
RLIMIT_MSGQUEUE: int
RLIMIT_NICE: int
RLIMIT_OFILE: int
RLIMIT_RTPRIO: int
RLIMIT_RTTIME: int
RLIMIT_SIGPENDING: int
RUSAGE_THREAD: int
class _RUsage(NamedTuple):
ru_utime: float
@@ -44,10 +44,10 @@ class _RUsage(NamedTuple):
ru_nivcsw: int
def getpagesize() -> int: ...
def getrlimit(resource: int) -> Tuple[int, int]: ...
def getrusage(who: int) -> _RUsage: ...
def prlimit(pid: int, resource: int, limits: Optional[Tuple[int, int]]) -> Tuple[int, int]: ...
def setrlimit(resource: int, limits: Tuple[int, int]) -> None: ...
def getrlimit(__resource: int) -> Tuple[int, int]: ...
def getrusage(__who: int) -> _RUsage: ...
def setrlimit(__resource: int, __limits: Tuple[int, int]) -> None: ...
if sys.platform == "linux":
def prlimit(pid: int, resource: int, limits: Optional[Tuple[int, int]]) -> Tuple[int, int]: ...
# NOTE: This is an alias of OSError in Python 3.3.
class error(Exception): ...
error = OSError

View File

@@ -198,9 +198,6 @@ pyclbr.Function.__init__
queue.SimpleQueue.__init__
random.Random.getrandbits
random.getrandbits
resource.getrlimit
resource.getrusage
resource.setrlimit
secrets.SystemRandom.getstate
secrets.compare_digest
select.epoll.__exit__