mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-09-04 14:06:58 +08:00
Import generics from standard modules in all third-party stubs (#7791)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import typing
|
||||
import collections.abc
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any, Pattern, Union
|
||||
from typing_extensions import TypeAlias
|
||||
@@ -50,7 +50,7 @@ class Regex(Expression):
|
||||
) -> None: ...
|
||||
|
||||
class Compound(Expression):
|
||||
members: typing.Sequence[Expression]
|
||||
members: collections.abc.Sequence[Expression]
|
||||
def __init__(self, *members: Expression, **kwargs: Any) -> None: ...
|
||||
|
||||
class Sequence(Compound): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import typing
|
||||
import collections.abc
|
||||
from collections import OrderedDict
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any, NoReturn
|
||||
@@ -23,32 +23,34 @@ class LazyReference(str):
|
||||
|
||||
class RuleVisitor(NodeVisitor):
|
||||
quantifier_classes: dict[str, type[Expression]]
|
||||
visit_expression: Callable[[RuleVisitor, Node, typing.Sequence[Any]], Any]
|
||||
visit_term: Callable[[RuleVisitor, Node, typing.Sequence[Any]], Any]
|
||||
visit_atom: Callable[[RuleVisitor, Node, typing.Sequence[Any]], Any]
|
||||
visit_expression: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any]
|
||||
visit_term: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any]
|
||||
visit_atom: Callable[[RuleVisitor, Node, collections.abc.Sequence[Any]], Any]
|
||||
custom_rules: dict[str, Expression]
|
||||
def __init__(self, custom_rules: Mapping[str, Expression] | None = ...) -> None: ...
|
||||
def visit_rules(
|
||||
self, node: Node, rules_list: typing.Sequence[Any]
|
||||
self, node: Node, rules_list: collections.abc.Sequence[Any]
|
||||
) -> tuple[OrderedDict[str, Expression], Expression | None]: ...
|
||||
def visit_rule(self, node: Node, rule: typing.Sequence[Any]) -> Expression: ...
|
||||
def visit_label(self, node: Node, label: typing.Sequence[Any]) -> str: ...
|
||||
def visit_ored(self, node: Node, ored: typing.Sequence[Any]) -> OneOf: ...
|
||||
def visit_or_term(self, node: Node, or_term: typing.Sequence[Any]) -> Expression: ...
|
||||
def visit_sequence(self, node: Node, sequence: typing.Sequence[Any]) -> Sequence: ...
|
||||
def visit_not_term(self, node: Node, not_term: typing.Sequence[Any]) -> Not: ...
|
||||
def visit_lookahead_term(self, node: Node, lookahead_term: typing.Sequence[Any]) -> Lookahead: ...
|
||||
def visit_quantified(self, node: Node, quantified: typing.Sequence[Any]) -> Expression: ...
|
||||
def visit_quantifier(self, node: Node, quantifier: typing.Sequence[Any]) -> Node: ...
|
||||
def visit_reference(self, node: Node, reference: typing.Sequence[Any]) -> LazyReference: ...
|
||||
def visit_literal(self, node: Node, literal: typing.Sequence[Any]) -> Literal: ...
|
||||
def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: typing.Sequence[Any]) -> Literal: ...
|
||||
def visit_regex(self, node: Node, regex: typing.Sequence[Any]) -> Regex: ...
|
||||
def visit_parenthesized(self, node: Node, parenthesized: typing.Sequence[Any]) -> Expression: ...
|
||||
def generic_visit(self, node: Node, visited_children: typing.Sequence[Any]) -> typing.Sequence[Any] | Node: ... # type: ignore[override]
|
||||
def visit_rule(self, node: Node, rule: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_label(self, node: Node, label: collections.abc.Sequence[Any]) -> str: ...
|
||||
def visit_ored(self, node: Node, ored: collections.abc.Sequence[Any]) -> OneOf: ...
|
||||
def visit_or_term(self, node: Node, or_term: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_sequence(self, node: Node, sequence: collections.abc.Sequence[Any]) -> Sequence: ...
|
||||
def visit_not_term(self, node: Node, not_term: collections.abc.Sequence[Any]) -> Not: ...
|
||||
def visit_lookahead_term(self, node: Node, lookahead_term: collections.abc.Sequence[Any]) -> Lookahead: ...
|
||||
def visit_quantified(self, node: Node, quantified: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_quantifier(self, node: Node, quantifier: collections.abc.Sequence[Any]) -> Node: ...
|
||||
def visit_reference(self, node: Node, reference: collections.abc.Sequence[Any]) -> LazyReference: ...
|
||||
def visit_literal(self, node: Node, literal: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> Regex: ...
|
||||
def visit_parenthesized(self, node: Node, parenthesized: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def generic_visit(self, node: Node, visited_children: collections.abc.Sequence[Any]) -> collections.abc.Sequence[Any] | Node: ... # type: ignore[override]
|
||||
|
||||
class TokenRuleVisitor(RuleVisitor):
|
||||
def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: typing.Sequence[Any]) -> TokenMatcher: ...
|
||||
def visit_regex(self, node: Node, regex: typing.Sequence[Any]) -> NoReturn: ...
|
||||
def visit_spaceless_literal(
|
||||
self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any]
|
||||
) -> TokenMatcher: ...
|
||||
def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> NoReturn: ...
|
||||
|
||||
rule_grammar: Grammar
|
||||
|
||||
Reference in New Issue
Block a user