mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 04:11:28 +08:00
Add stubs for jmespath (#5780)
This commit is contained in:
1
stubs/jmespath/METADATA.toml
Normal file
1
stubs/jmespath/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "0.10"
|
||||
7
stubs/jmespath/jmespath/__init__.pyi
Normal file
7
stubs/jmespath/jmespath/__init__.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from jmespath import parser as parser
|
||||
from jmespath.visitor import Options as Options
|
||||
|
||||
def compile(expression): ...
|
||||
def search(expression, data, options: Any | None = ...): ...
|
||||
22
stubs/jmespath/jmespath/ast.pyi
Normal file
22
stubs/jmespath/jmespath/ast.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
def comparator(name, first, second): ...
|
||||
def current_node(): ...
|
||||
def expref(expression): ...
|
||||
def function_expression(name, args): ...
|
||||
def field(name): ...
|
||||
def filter_projection(left, right, comparator): ...
|
||||
def flatten(node): ...
|
||||
def identity(): ...
|
||||
def index(index): ...
|
||||
def index_expression(children): ...
|
||||
def key_val_pair(key_name, node): ...
|
||||
def literal(literal_value): ...
|
||||
def multi_select_dict(nodes): ...
|
||||
def multi_select_list(nodes): ...
|
||||
def or_expression(left, right): ...
|
||||
def and_expression(left, right): ...
|
||||
def not_expression(expr): ...
|
||||
def pipe(left, right): ...
|
||||
def projection(left, right): ...
|
||||
def subexpression(children): ...
|
||||
def slice(start, end, step): ...
|
||||
def value_projection(left, right): ...
|
||||
46
stubs/jmespath/jmespath/exceptions.pyi
Normal file
46
stubs/jmespath/jmespath/exceptions.pyi
Normal file
@@ -0,0 +1,46 @@
|
||||
from typing import Any
|
||||
|
||||
class JMESPathError(ValueError): ...
|
||||
|
||||
class ParseError(JMESPathError):
|
||||
lex_position: Any
|
||||
token_value: Any
|
||||
token_type: Any
|
||||
msg: Any
|
||||
expression: Any
|
||||
def __init__(self, lex_position, token_value, token_type, msg=...) -> None: ...
|
||||
|
||||
class IncompleteExpressionError(ParseError):
|
||||
expression: Any
|
||||
lex_position: Any
|
||||
token_type: Any
|
||||
token_value: Any
|
||||
def set_expression(self, expression) -> None: ...
|
||||
|
||||
class LexerError(ParseError):
|
||||
lexer_position: Any
|
||||
lexer_value: Any
|
||||
message: Any
|
||||
expression: Any
|
||||
def __init__(self, lexer_position, lexer_value, message, expression: Any | None = ...) -> None: ...
|
||||
|
||||
class ArityError(ParseError):
|
||||
expected_arity: Any
|
||||
actual_arity: Any
|
||||
function_name: Any
|
||||
expression: Any
|
||||
def __init__(self, expected, actual, name) -> None: ...
|
||||
|
||||
class VariadictArityError(ArityError): ...
|
||||
|
||||
class JMESPathTypeError(JMESPathError):
|
||||
function_name: Any
|
||||
current_value: Any
|
||||
actual_type: Any
|
||||
expected_types: Any
|
||||
def __init__(self, function_name, current_value, actual_type, expected_types) -> None: ...
|
||||
|
||||
class EmptyExpressionError(JMESPathError):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class UnknownFunctionError(JMESPathError): ...
|
||||
13
stubs/jmespath/jmespath/functions.pyi
Normal file
13
stubs/jmespath/jmespath/functions.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
TYPES_MAP: Any
|
||||
REVERSE_TYPES_MAP: Any
|
||||
|
||||
def signature(*arguments): ...
|
||||
|
||||
class FunctionRegistry(type):
|
||||
def __init__(cls, name, bases, attrs) -> None: ...
|
||||
|
||||
class Functions:
|
||||
FUNCTION_TABLE: Any
|
||||
def call_function(self, function_name, resolved_args): ...
|
||||
11
stubs/jmespath/jmespath/lexer.pyi
Normal file
11
stubs/jmespath/jmespath/lexer.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import Any
|
||||
|
||||
from jmespath.exceptions import EmptyExpressionError as EmptyExpressionError, LexerError as LexerError
|
||||
|
||||
class Lexer:
|
||||
START_IDENTIFIER: Any
|
||||
VALID_IDENTIFIER: Any
|
||||
VALID_NUMBER: Any
|
||||
WHITESPACE: Any
|
||||
SIMPLE_TOKENS: Any
|
||||
def tokenize(self, expression) -> None: ...
|
||||
15
stubs/jmespath/jmespath/parser.pyi
Normal file
15
stubs/jmespath/jmespath/parser.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import Any
|
||||
|
||||
class Parser:
|
||||
BINDING_POWER: Any
|
||||
tokenizer: Any
|
||||
def __init__(self, lookahead: int = ...) -> None: ...
|
||||
def parse(self, expression): ...
|
||||
@classmethod
|
||||
def purge(cls) -> None: ...
|
||||
|
||||
class ParsedResult:
|
||||
expression: Any
|
||||
parsed: Any
|
||||
def __init__(self, expression, parsed) -> None: ...
|
||||
def search(self, value, options: Any | None = ...): ...
|
||||
49
stubs/jmespath/jmespath/visitor.pyi
Normal file
49
stubs/jmespath/jmespath/visitor.pyi
Normal file
@@ -0,0 +1,49 @@
|
||||
from typing import Any
|
||||
|
||||
class Options:
|
||||
dict_cls: Any
|
||||
custom_functions: Any
|
||||
def __init__(self, dict_cls: Any | None = ..., custom_functions: Any | None = ...) -> None: ...
|
||||
|
||||
class _Expression:
|
||||
expression: Any
|
||||
interpreter: Any
|
||||
def __init__(self, expression, interpreter) -> None: ...
|
||||
def visit(self, node, *args, **kwargs): ...
|
||||
|
||||
class Visitor:
|
||||
def __init__(self) -> None: ...
|
||||
def visit(self, node, *args, **kwargs): ...
|
||||
def default_visit(self, node, *args, **kwargs) -> None: ...
|
||||
|
||||
class TreeInterpreter(Visitor):
|
||||
COMPARATOR_FUNC: Any
|
||||
MAP_TYPE: Any
|
||||
def __init__(self, options: Any | None = ...) -> None: ...
|
||||
def default_visit(self, node, *args, **kwargs) -> None: ...
|
||||
def visit_subexpression(self, node, value): ...
|
||||
def visit_field(self, node, value): ...
|
||||
def visit_comparator(self, node, value): ...
|
||||
def visit_current(self, node, value): ...
|
||||
def visit_expref(self, node, value): ...
|
||||
def visit_function_expression(self, node, value): ...
|
||||
def visit_filter_projection(self, node, value): ...
|
||||
def visit_flatten(self, node, value): ...
|
||||
def visit_identity(self, node, value): ...
|
||||
def visit_index(self, node, value): ...
|
||||
def visit_index_expression(self, node, value): ...
|
||||
def visit_slice(self, node, value): ...
|
||||
def visit_key_val_pair(self, node, value): ...
|
||||
def visit_literal(self, node, value): ...
|
||||
def visit_multi_select_dict(self, node, value): ...
|
||||
def visit_multi_select_list(self, node, value): ...
|
||||
def visit_or_expression(self, node, value): ...
|
||||
def visit_and_expression(self, node, value): ...
|
||||
def visit_not_expression(self, node, value): ...
|
||||
def visit_pipe(self, node, value): ...
|
||||
def visit_projection(self, node, value): ...
|
||||
def visit_value_projection(self, node, value): ...
|
||||
|
||||
class GraphvizVisitor(Visitor):
|
||||
def __init__(self) -> None: ...
|
||||
def visit(self, node, *args, **kwargs): ...
|
||||
Reference in New Issue
Block a user