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,6 +1,6 @@
from typing import Any
from typing import Any, List
class State(list):
class State(List[Any]):
def set(self, state) -> None: ...
def reset(self) -> None: ...
def isstate(self, state): ...

View File

@@ -17,7 +17,7 @@ class BlockProcessor:
class ListIndentProcessor(BlockProcessor):
ITEM_TYPES: Any
LIST_TYPES: Any
INDENT_RE: Pattern
INDENT_RE: Pattern[str]
def __init__(self, *args) -> None: ...
def create_item(self, parent, block) -> None: ...
def get_level(self, parent, block): ...
@@ -25,7 +25,7 @@ class ListIndentProcessor(BlockProcessor):
class CodeBlockProcessor(BlockProcessor): ...
class BlockQuoteProcessor(BlockProcessor):
RE: Pattern
RE: Pattern[str]
def clean(self, line): ...
class OListProcessor(BlockProcessor):
@@ -33,26 +33,26 @@ class OListProcessor(BlockProcessor):
STARTSWITH: str = ...
LAZY_OL: bool = ...
SIBLING_TAGS: Any
RE: Pattern
CHILD_RE: Pattern
INDENT_RE: Pattern
RE: Pattern[str]
CHILD_RE: Pattern[str]
INDENT_RE: Pattern[str]
def __init__(self, parser) -> None: ...
def get_items(self, block): ...
class UListProcessor(OListProcessor):
TAG: str = ...
RE: Pattern
RE: Pattern[str]
def __init__(self, parser) -> None: ...
class HashHeaderProcessor(BlockProcessor):
RE: Pattern
RE: Pattern[str]
class SetextHeaderProcessor(BlockProcessor):
RE: Pattern
RE: Pattern[str]
class HRProcessor(BlockProcessor):
RE: str = ...
SEARCH_RE: Pattern
SEARCH_RE: Pattern[str]
match: Any
class EmptyBlockProcessor(BlockProcessor): ...

View File

@@ -4,7 +4,7 @@ from markdown.blockprocessors import BlockProcessor
from markdown.extensions import Extension
from markdown.inlinepatterns import InlineProcessor
ABBR_REF_RE: Pattern
ABBR_REF_RE: Pattern[str]
class AbbrExtension(Extension): ...
class AbbrPreprocessor(BlockProcessor): ...

View File

@@ -6,9 +6,9 @@ from markdown.extensions import Extension
class AdmonitionExtension(Extension): ...
class AdmonitionProcessor(BlockProcessor):
CLASSNAME: str = ...
CLASSNAME_TITLE: str = ...
RE: Pattern
CLASSNAME: str
CLASSNAME_TITLE: str
RE: Pattern[str]
RE_SPACES: Any
def get_class_and_title(self, match): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Pattern
from typing import Pattern
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
@@ -7,11 +7,11 @@ def get_attrs(str): ...
def isheader(elem): ...
class AttrListTreeprocessor(Treeprocessor):
BASE_RE: str = ...
HEADER_RE: Pattern
BLOCK_RE: Pattern
INLINE_RE: Pattern
NAME_RE: Pattern
BASE_RE: str
HEADER_RE: Pattern[str]
BLOCK_RE: Pattern[str]
INLINE_RE: Pattern[str]
NAME_RE: Pattern[str]
def assign_attrs(self, elem, attrs) -> None: ...
def sanitize_name(self, name): ...

View File

@@ -1,11 +1,11 @@
from typing import Any, Pattern
from typing import Pattern
from markdown.blockprocessors import BlockProcessor, ListIndentProcessor
from markdown.extensions import Extension
class DefListProcessor(BlockProcessor):
RE: Pattern
NO_INDENT_RE: Pattern
RE: Pattern[str]
NO_INDENT_RE: Pattern[str]
class DefListIndentProcessor(ListIndentProcessor): ...
class DefListExtension(Extension): ...

View File

@@ -6,7 +6,7 @@ from markdown.preprocessors import Preprocessor
class FencedCodeExtension(Extension): ...
class FencedBlockPreprocessor(Preprocessor):
FENCED_BLOCK_RE: Pattern
FENCED_BLOCK_RE: Pattern[str]
CODE_WRAP: str = ...
LANG_TAG: str = ...
checked_for_codehilite: bool = ...

View File

@@ -8,8 +8,8 @@ from markdown.treeprocessors import Treeprocessor
FN_BACKLINK_TEXT: Any
NBSP_PLACEHOLDER: Any
DEF_RE: Pattern
TABBED_RE: Pattern
DEF_RE: Pattern[str]
TABBED_RE: Pattern[str]
RE_REF_ID: Any
class FootnoteExtension(Extension):

View File

@@ -1,9 +1,9 @@
from typing import Any, Pattern
from typing import Pattern
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
ATTR_RE: Pattern
ATTR_RE: Pattern[str]
class LegacyAttrs(Treeprocessor):
def handleAttributes(self, el, txt): ...

View File

@@ -1,5 +1,3 @@
from typing import Any
from markdown.extensions import Extension
from markdown.inlinepatterns import UnderscoreProcessor

View File

@@ -1,5 +1,3 @@
from typing import Any, Optional
from markdown.blockprocessors import BlockProcessor
from markdown.extensions import Extension

View File

@@ -4,10 +4,10 @@ from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
log: Any
META_RE: Pattern
META_MORE_RE: Pattern
BEGIN_RE: Pattern
END_RE: Pattern
META_RE: Pattern[str]
META_MORE_RE: Pattern[str]
BEGIN_RE: Pattern[str]
END_RE: Pattern[str]
class MetaExtension(Extension):
md: Any

View File

@@ -1,5 +1,3 @@
from typing import Any
from markdown.extensions import Extension
BR_RE: str

View File

@@ -1,5 +1,3 @@
from typing import Any, Pattern
from markdown.blockprocessors import OListProcessor, UListProcessor
from markdown.extensions import Extension

View File

@@ -1,4 +1,4 @@
from typing import Any, Pattern
from typing import Any
from markdown.extensions import Extension
from markdown.inlinepatterns import HtmlInlineProcessor

View File

@@ -5,7 +5,7 @@ from markdown.treeprocessors import Treeprocessor
def slugify(value, separator): ...
IDCOUNT_RE: Pattern
IDCOUNT_RE: Pattern[str]
def unique(id, ids): ...
def get_name(el): ...

View File

@@ -40,14 +40,14 @@ class Pattern:
@property
def markdown(self): ...
def getCompiledRegExp(self): ...
def handleMatch(self, m: Match) -> Optional[Union[str, Element]]: ...
def handleMatch(self, m: Match[str]) -> Optional[Union[str, Element]]: ...
def type(self): ...
def unescape(self, text): ...
class InlineProcessor(Pattern):
safe_mode: bool = ...
def __init__(self, pattern, md: Optional[Any] = ...) -> None: ...
def handleMatch(self, m: Match, data) -> Union[Tuple[Element, int, int], Tuple[None, None, None]]: ... # type: ignore
def handleMatch(self, m: Match[str], data) -> Union[Tuple[Element, int, int], Tuple[None, None, None]]: ... # type: ignore
class SimpleTextPattern(Pattern): ...
class SimpleTextInlineProcessor(InlineProcessor): ...

View File

@@ -1,5 +1,3 @@
from typing import Any
class Version:
def __new__(cls, major, minor, micro, release: str = ..., pre: int = ..., post: int = ..., dev: int = ...): ...

View File

@@ -13,5 +13,5 @@ class RawHtmlPostprocessor(Postprocessor):
class AndSubstitutePostprocessor(Postprocessor): ...
class UnescapePostprocessor(Postprocessor):
RE: Pattern
RE: Pattern[str]
def unescape(self, m): ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Iterable, List, Pattern
from typing import Any, List, Pattern
from . import util
@@ -19,5 +19,5 @@ class HtmlBlockPreprocessor(Preprocessor):
class ReferencePreprocessor(Preprocessor):
TITLE: str = ...
RE: Pattern
TITLE_RE: Pattern
RE: Pattern[str]
TITLE_RE: Pattern[str]

View File

@@ -1,4 +1,2 @@
from typing import Any
def to_html_string(element): ...
def to_xhtml_string(element): ...

View File

@@ -1,4 +1,3 @@
from collections import namedtuple
from typing import Any, Optional, Pattern
PY37: Any
@@ -8,10 +7,10 @@ STX: str
ETX: str
INLINE_PLACEHOLDER_PREFIX: Any
INLINE_PLACEHOLDER: Any
INLINE_PLACEHOLDER_RE: Pattern
INLINE_PLACEHOLDER_RE: Pattern[str]
AMP_SUBSTITUTE: Any
HTML_PLACEHOLDER: Any
HTML_PLACEHOLDER_RE: Pattern
HTML_PLACEHOLDER_RE: Pattern[str]
TAG_PLACEHOLDER: Any
INSTALLED_EXTENSIONS: Any
RTL_BIDI_RANGES: Any