Enable pyright for all Python 3 stubs (#5597)

* pyright: disable reportUnknownParameterType

Unknown parameter types are preferred over Any annotations for
incomplete stubs. Especially larger stubs are expected to be
incomplete for some time and it would be a shame to lose the
other pyright warnings for those stubs.

* Also disable reportUnknownVariableType

Fix problems with tkinter

* Disable reportUnknownMemberType

Fix pyright problems
This commit is contained in:
Sebastian Rittau
2021-06-09 16:14:22 +02:00
committed by GitHub
parent c601d5cf3d
commit 711580722b
78 changed files with 633 additions and 687 deletions

View File

@@ -1,12 +1,15 @@
from collections import namedtuple
from logging import Logger
from typing import Any, Callable, Mapping, Optional, Sequence, Set
from typing import Any, Callable, Mapping, NamedTuple, Optional, Sequence, Set
from .utilities import BadRequest as BadRequest
PROXY_HEADERS: frozenset
PROXY_HEADERS: frozenset[Any]
Forwarded = namedtuple("Forwarded", ["by", "for_", "host", "proto"])
class Forwarded(NamedTuple):
by: Any
for_: Any
host: Any
proto: Any
class MalformedProxyHeader(Exception):
header: str = ...

View File

@@ -1,4 +1,4 @@
from typing import Pattern
from typing import Any, Pattern
from .compat import tobytes as tobytes
@@ -13,4 +13,4 @@ VCHAR: str
FIELD_VCHAR: str
FIELD_CONTENT: str
FIELD_VALUE: str
HEADER_FIELD: Pattern
HEADER_FIELD: Pattern[Any]

View File

@@ -2,7 +2,7 @@ from io import TextIOWrapper
from typing import Any, Callable, Optional, Pattern, Sequence, Tuple
HELP: str
RUNNER_PATTERN: Pattern
RUNNER_PATTERN: Pattern[Any]
def match(obj_name: str) -> Tuple[str, str]: ...
def resolve(module_name: str, object_name: str) -> Any: ...

View File

@@ -1,19 +1,19 @@
from logging import Logger
from threading import Condition, Lock
from typing import Any, Deque, Mapping, Optional, Sequence, Set, Tuple
from typing import Any, Deque, Mapping, Optional, Sequence, Tuple
from .channel import HTTPChannel
from .utilities import Error
rename_headers: Mapping[str, str]
hop_by_hop: frozenset
hop_by_hop: frozenset[Any]
class ThreadedTaskDispatcher:
stop_count: int = ...
active_count: int = ...
logger: Logger = ...
queue_logger: Logger = ...
threads: Set = ...
threads: set[Any] = ...
queue: Deque[Task] = ...
lock: Lock = ...
queue_cv: Condition = ...

View File

@@ -21,14 +21,14 @@ months: Sequence[str]
monmap: Mapping[str, int]
months_reg: str
rfc822_date: str
rfc822_reg: Pattern
rfc822_reg: Pattern[Any]
def unpack_rfc822(m: Match) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
def unpack_rfc822(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
rfc850_date: str
rfc850_reg: Pattern
rfc850_reg: Pattern[Any]
def unpack_rfc850(m: Match) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
def unpack_rfc850(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
weekdayname: Sequence[str]
monthname: Sequence[str]
@@ -41,8 +41,8 @@ obs_text_re: str
qdtext_re: str
quoted_pair_re: str
quoted_string_re: str
quoted_string: Pattern
quoted_pair: Pattern
quoted_string: Pattern[Any]
quoted_pair: Pattern[Any]
def undquote(value: str) -> str: ...
def cleanup_unix_socket(path: str) -> None: ...

View File

@@ -32,7 +32,7 @@ class dispatcher:
connecting: bool = ...
closing: bool = ...
addr: Optional[Tuple[str, int]] = ...
ignore_log_types: frozenset = ...
ignore_log_types: frozenset[Any]
logger: Logger = ...
compact_traceback: Callable[[], Tuple[Tuple[str, str, str], BaseException, BaseException, str]] = ...
socket: Optional[_socket] = ...