Fix stubtest issues (#5360)

* Fix some stubtest issues

* Remove MADV_SOFT_OFFLINE
This commit is contained in:
hatal175
2021-05-07 19:10:03 +03:00
committed by GitHub
parent e3f510e896
commit 2dc02ae8a9
8 changed files with 34 additions and 33 deletions

View File

@@ -82,26 +82,37 @@ else:
def __delitem__(self, index: Union[int, slice]) -> None: ...
def __setitem__(self, index: Union[int, slice], object: bytes) -> None: ...
if sys.version_info >= (3, 8):
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int
MADV_RANDOM: int
MADV_SEQUENTIAL: int
MADV_WILLNEED: int
MADV_DONTNEED: int
MADV_REMOVE: int
MADV_DONTFORK: int
MADV_DOFORK: int
MADV_HWPOISON: int
MADV_MERGEABLE: int
MADV_UNMERGEABLE: int
MADV_SOFT_OFFLINE: int
MADV_HUGEPAGE: int
MADV_NOHUGEPAGE: int
MADV_DONTDUMP: int
MADV_DODUMP: int
MADV_FREE: int
MADV_NOSYNC: int
MADV_AUTOSYNC: int
MADV_NOCORE: int
MADV_CORE: int
MADV_PROTECT: int
if sys.platform == "linux":
MADV_REMOVE: int
MADV_DONTFORK: int
MADV_DOFORK: int
MADV_HWPOISON: int
MADV_MERGEABLE: int
MADV_UNMERGEABLE: int
# Seems like this constant is not defined in glibc.
# See https://github.com/python/typeshed/pull/5360 for details
# MADV_SOFT_OFFLINE: int
MADV_HUGEPAGE: int
MADV_NOHUGEPAGE: int
MADV_DONTDUMP: int
MADV_DODUMP: int
MADV_FREE: int
# This Values are defined for FreeBSD but type checkers do not support conditions for these
if sys.platform != "linux" and sys.platform != "darwin":
MADV_NOSYNC: int
MADV_AUTOSYNC: int
MADV_NOCORE: int
MADV_CORE: int
MADV_PROTECT: int
if sys.version_info >= (3, 10) and sys.platform == "darwin":
MADV_FREE_REUSABLE: int
MADV_FREE_REUSE: int

View File

@@ -97,7 +97,6 @@ class BaseHandler:
parent: OpenerDirector
def add_parent(self, parent: OpenerDirector) -> None: ...
def close(self) -> None: ...
def http_error_nnn(self, req: Request, fp: IO[str], code: int, msg: int, headers: Mapping[str, str]) -> _UrlopenRet: ...
class HTTPDefaultErrorHandler(BaseHandler):
def http_error_default(

View File

@@ -10,7 +10,7 @@ class RobotFileParser:
def set_url(self, url: str) -> None: ...
def read(self) -> None: ...
def parse(self, lines: Iterable[str]) -> None: ...
def can_fetch(self, user_agent: str, url: str) -> bool: ...
def can_fetch(self, useragent: str, url: str) -> bool: ...
def mtime(self) -> int: ...
def modified(self) -> None: ...
def crawl_delay(self, useragent: str) -> Optional[str]: ...

View File

@@ -48,7 +48,6 @@ class UnixBrowser(BaseBrowser):
def open(self, url: Text, new: int = ..., autoraise: bool = ...) -> bool: ...
class Mozilla(UnixBrowser):
raise_opts: List[str]
remote_args: List[str]
remote_action: str
remote_action_newwin: str