mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-09-02 13:06:59 +08:00
Add default values for third-party stubs beginning with 'P' (#9957)
This commit is contained in:
@@ -7,7 +7,7 @@ class ParseError(StrAndRepr, Exception):
|
||||
text: str
|
||||
pos: int
|
||||
expr: Expression | None
|
||||
def __init__(self, text: str, pos: int = ..., expr: Expression | None = ...) -> None: ...
|
||||
def __init__(self, text: str, pos: int = -1, expr: Expression | None = None) -> None: ...
|
||||
def line(self) -> int: ...
|
||||
def column(self) -> int: ...
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@ IN_PROGRESS: object
|
||||
class Expression(StrAndRepr):
|
||||
name: str
|
||||
identity_tuple: tuple[str]
|
||||
def __init__(self, name: str = ...) -> None: ...
|
||||
def __init__(self, name: str = "") -> None: ...
|
||||
def resolve_refs(self, rule_map: Mapping[str, Expression]) -> Self: ...
|
||||
def parse(self, text: str, pos: int = ...) -> Node: ...
|
||||
def match(self, text: str, pos: int = ...) -> Node: ...
|
||||
def parse(self, text: str, pos: int = 0) -> Node: ...
|
||||
def match(self, text: str, pos: int = 0) -> Node: ...
|
||||
def match_core(self, text: str, pos: int, cache: Mapping[tuple[int, int], Node], error: ParseError) -> Node: ...
|
||||
def as_rule(self) -> str: ...
|
||||
|
||||
class Literal(Expression):
|
||||
literal: str
|
||||
identity_tuple: tuple[str, str] # type: ignore[assignment]
|
||||
def __init__(self, literal: str, name: str = ...) -> None: ...
|
||||
def __init__(self, literal: str, name: str = "") -> None: ...
|
||||
|
||||
class TokenMatcher(Literal): ...
|
||||
|
||||
@@ -43,14 +43,14 @@ class Regex(Expression):
|
||||
def __init__(
|
||||
self,
|
||||
pattern: str,
|
||||
name: str = ...,
|
||||
ignore_case: bool = ...,
|
||||
locale: bool = ...,
|
||||
multiline: bool = ...,
|
||||
dot_all: bool = ...,
|
||||
unicode: bool = ...,
|
||||
verbose: bool = ...,
|
||||
ascii: bool = ...,
|
||||
name: str = "",
|
||||
ignore_case: bool = False,
|
||||
locale: bool = False,
|
||||
multiline: bool = False,
|
||||
dot_all: bool = False,
|
||||
unicode: bool = False,
|
||||
verbose: bool = False,
|
||||
ascii: bool = False,
|
||||
) -> None: ...
|
||||
|
||||
class Compound(Expression):
|
||||
@@ -62,15 +62,15 @@ class OneOf(Compound): ...
|
||||
|
||||
class Lookahead(Compound):
|
||||
negativity: bool
|
||||
def __init__(self, member: Expression, *, negative: bool = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(self, member: Expression, *, negative: bool = False, **kwargs: Any) -> None: ...
|
||||
|
||||
def Not(term: Expression) -> Lookahead: ...
|
||||
|
||||
class Quantifier(Compound):
|
||||
min: int
|
||||
max: float
|
||||
def __init__(self, member: Expression, *, min: int = ..., max: float = ..., name: str = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(self, member: Expression, *, min: int = 0, 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: ...
|
||||
def ZeroOrMore(member: Expression, name: str = "") -> Quantifier: ...
|
||||
def OneOrMore(member: Expression, name: str = "", min: int = 1) -> Quantifier: ...
|
||||
def Optional(member: Expression, name: str = "") -> Quantifier: ...
|
||||
|
||||
@@ -9,10 +9,10 @@ from parsimonious.nodes import Node, NodeVisitor
|
||||
|
||||
class Grammar(OrderedDict[str, Expression]):
|
||||
default_rule: Expression | Incomplete
|
||||
def __init__(self, rules: str = ..., **more_rules: Expression | _CALLABLE_TYPE) -> None: ...
|
||||
def __init__(self, rules: str = "", **more_rules: Expression | _CALLABLE_TYPE) -> None: ...
|
||||
def default(self, rule_name: str) -> Grammar: ...
|
||||
def parse(self, text: str, pos: int = ...) -> Node: ...
|
||||
def match(self, text: str, pos: int = ...) -> Node: ...
|
||||
def parse(self, text: str, pos: int = 0) -> Node: ...
|
||||
def match(self, text: str, pos: int = 0) -> Node: ...
|
||||
|
||||
class TokenGrammar(Grammar): ...
|
||||
class BootstrappingGrammar(Grammar): ...
|
||||
@@ -29,7 +29,7 @@ class RuleVisitor(NodeVisitor[tuple[OrderedDict[str, Expression], Expression | N
|
||||
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 __init__(self, custom_rules: Mapping[str, Expression] | None = 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: ...
|
||||
|
||||
@@ -13,14 +13,16 @@ class Node:
|
||||
start: int
|
||||
end: int
|
||||
children: Sequence[Node]
|
||||
def __init__(self, expr: Expression, full_text: str, start: int, end: int, children: Sequence[Node] | None = ...) -> None: ...
|
||||
def __init__(
|
||||
self, expr: Expression, full_text: str, start: int, end: int, children: Sequence[Node] | None = None
|
||||
) -> None: ...
|
||||
@property
|
||||
def expr_name(self) -> str: ...
|
||||
def __iter__(self) -> Iterator[Node]: ...
|
||||
@property
|
||||
def text(self) -> str: ...
|
||||
def prettily(self, error: Node | None = ...) -> str: ...
|
||||
def __repr__(self, top_level: bool = ...) -> str: ...
|
||||
def prettily(self, error: Node | None = None) -> str: ...
|
||||
def __repr__(self, top_level: bool = True) -> str: ...
|
||||
|
||||
class RegexNode(Node):
|
||||
match: Match[str]
|
||||
@@ -35,8 +37,8 @@ class NodeVisitor(Generic[_VisitResultT], metaclass=RuleDecoratorMeta):
|
||||
unwrapped_exceptions: tuple[type[BaseException], ...]
|
||||
def visit(self, node: Node) -> _VisitResultT: ...
|
||||
def generic_visit(self, node: Node, visited_children: Sequence[Any]) -> Incomplete: ...
|
||||
def parse(self, text: str, pos: int = ...) -> _VisitResultT: ...
|
||||
def match(self, text: str, pos: int = ...) -> _VisitResultT: ...
|
||||
def parse(self, text: str, pos: int = 0) -> _VisitResultT: ...
|
||||
def match(self, text: str, pos: int = 0) -> _VisitResultT: ...
|
||||
def lift_child(self, node: Node, children: Sequence[_ChildT]) -> _ChildT: ...
|
||||
|
||||
_CallableT = TypeVar("_CallableT", bound=Callable[..., Any])
|
||||
|
||||
Reference in New Issue
Block a user