mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-08 12:34:44 +08:00
Update parsimonious to 0.10.0 (#8730)
This commit is contained in:
@@ -1,2 +1 @@
|
||||
parsimonious.nodes.Node.__repr__
|
||||
parsimonious.nodes.RuleDecoratorMeta.__new__
|
||||
|
||||
@@ -1 +1 @@
|
||||
version = "0.9.*"
|
||||
version = "0.10.*"
|
||||
|
||||
@@ -11,6 +11,7 @@ class ParseError(StrAndRepr, Exception):
|
||||
def line(self) -> int: ...
|
||||
def column(self) -> int: ...
|
||||
|
||||
class LeftRecursionError(ParseError): ...
|
||||
class IncompleteParseError(ParseError): ...
|
||||
|
||||
class VisitationError(Exception):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import collections.abc
|
||||
from _typeshed import Self
|
||||
from collections.abc import Callable, Mapping
|
||||
from re import Pattern
|
||||
from typing import Any, Union
|
||||
@@ -9,20 +10,22 @@ from parsimonious.grammar import Grammar
|
||||
from parsimonious.nodes import Node
|
||||
from parsimonious.utils import StrAndRepr
|
||||
|
||||
MARKER: Any
|
||||
|
||||
_CALLABLE_RETURN_TYPE: TypeAlias = Union[int, tuple[int, list[Node]], Node, None]
|
||||
_CALLABLE_TYPE: TypeAlias = (
|
||||
Callable[[str, int], _CALLABLE_RETURN_TYPE]
|
||||
| Callable[[str, int, Mapping[tuple[int, int], Node], ParseError, Grammar], _CALLABLE_RETURN_TYPE]
|
||||
)
|
||||
|
||||
def is_callable(value: object) -> bool: ...
|
||||
def expression(callable: _CALLABLE_TYPE, rule_name: str, grammar: Grammar) -> Expression: ...
|
||||
|
||||
IN_PROGRESS: object
|
||||
|
||||
class Expression(StrAndRepr):
|
||||
name: str
|
||||
identity_tuple: tuple[str]
|
||||
def __init__(self, name: str = ...) -> None: ...
|
||||
def resolve_refs(self: Self, rule_map: Mapping[str, Expression]) -> Self: ...
|
||||
def parse(self, text: str, pos: int = ...) -> Node: ...
|
||||
def match(self, text: str, pos: int = ...) -> Node: ...
|
||||
def match_core(self, text: str, pos: int, cache: Mapping[tuple[int, int], Node], error: ParseError) -> Node: ...
|
||||
@@ -57,11 +60,18 @@ class Compound(Expression):
|
||||
|
||||
class Sequence(Compound): ...
|
||||
class OneOf(Compound): ...
|
||||
class Lookahead(Compound): ...
|
||||
class Not(Compound): ...
|
||||
class Optional(Compound): ...
|
||||
class ZeroOrMore(Compound): ...
|
||||
|
||||
class OneOrMore(Compound):
|
||||
class Lookahead(Compound):
|
||||
negativity: bool
|
||||
def __init__(self, member: Expression, *, negative: bool = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
def Not(term: Expression) -> Lookahead: ...
|
||||
|
||||
class Quantifier(Compound):
|
||||
min: int
|
||||
def __init__(self, member: Expression, name: str = ..., min: int = ...) -> None: ...
|
||||
max: float
|
||||
def __init__(self, member: Expression, *, min: int = ..., max: float = ..., name: str = ..., **kwargs: Any) -> None: ...
|
||||
|
||||
def ZeroOrMore(member: Expression, name: str = ...) -> Quantifier: ...
|
||||
def OneOrMore(member: Expression, name: str = ..., min: int = ...) -> Quantifier: ...
|
||||
def Optional(member: Expression, name: str = ...) -> Quantifier: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from collections import OrderedDict
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any, NoReturn
|
||||
|
||||
from parsimonious.expressions import _CALLABLE_TYPE, Expression, Literal, Lookahead, Not, OneOf, Regex, Sequence, TokenMatcher
|
||||
from parsimonious.expressions import _CALLABLE_TYPE, Expression, Literal, Lookahead, OneOf, Regex, Sequence, TokenMatcher
|
||||
from parsimonious.nodes import Node, NodeVisitor
|
||||
|
||||
class Grammar(OrderedDict[str, Expression]):
|
||||
@@ -20,6 +20,7 @@ rule_syntax: str
|
||||
|
||||
class LazyReference(str):
|
||||
name: str
|
||||
def resolve_refs(self, rule_map: Mapping[str, Expression | LazyReference]) -> Expression: ...
|
||||
|
||||
class RuleVisitor(NodeVisitor):
|
||||
quantifier_classes: dict[str, type[Expression]]
|
||||
@@ -28,24 +29,24 @@ class RuleVisitor(NodeVisitor):
|
||||
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_parenthesized(self, node: Node, parenthesized: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_quantifier(self, node: Node, quantifier: collections.abc.Sequence[Any]) -> Node: ...
|
||||
def visit_quantified(self, node: Node, quantified: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_lookahead_term(self, node: Node, lookahead_term: collections.abc.Sequence[Any]) -> Lookahead: ...
|
||||
def visit_not_term(self, node: Node, not_term: collections.abc.Sequence[Any]) -> Lookahead: ...
|
||||
def visit_rule(self, node: Node, rule: collections.abc.Sequence[Any]) -> Expression: ...
|
||||
def visit_sequence(self, node: Node, sequence: collections.abc.Sequence[Any]) -> Sequence: ...
|
||||
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_label(self, node: Node, label: collections.abc.Sequence[Any]) -> str: ...
|
||||
def visit_reference(self, node: Node, reference: collections.abc.Sequence[Any]) -> LazyReference: ...
|
||||
def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> Regex: ...
|
||||
def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def visit_literal(self, node: Node, literal: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def generic_visit(self, node: Node, visited_children: collections.abc.Sequence[Any]) -> collections.abc.Sequence[Any] | Node: ... # type: ignore[override]
|
||||
def visit_rules(
|
||||
self, node: Node, rules_list: collections.abc.Sequence[Any]
|
||||
) -> tuple[OrderedDict[str, Expression], Expression | None]: ...
|
||||
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(
|
||||
|
||||
@@ -19,6 +19,7 @@ class Node:
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
def prettily(self, error: Node | None = ...) -> str: ...
|
||||
def __repr__(self, top_level: bool = ...) -> str: ...
|
||||
|
||||
class RegexNode(Node):
|
||||
match: Match[str]
|
||||
@@ -27,7 +28,7 @@ class RuleDecoratorMeta(type): ...
|
||||
|
||||
class NodeVisitor(metaclass=RuleDecoratorMeta):
|
||||
grammar: Grammar | Any
|
||||
unwrapped_exceptions: tuple[type[Exception], ...]
|
||||
unwrapped_exceptions: tuple[type[BaseException], ...]
|
||||
def visit(self, node: Node) -> Any: ...
|
||||
def generic_visit(self, node: Node, visited_children: Sequence[Any]) -> NoReturn: ...
|
||||
def parse(self, text: str, pos: int = ...) -> Node: ...
|
||||
|
||||
Reference in New Issue
Block a user