parsing module¶
Utilities for parsing.
ann_args_to_args function¶
Convert annotated arguments back to positional and keyword arguments.
annotate_args function¶
annotate_args(
func,
args,
kwargs,
only_passed=False,
allow_partial=False,
attach_annotations=False,
flatten=False
)
Annotate arguments and keyword arguments using the function's signature.
If allow_partial is True, required arguments that weren't provided won't raise an error. But regardless of allow_partial, arguments that aren't in the signature will still raise an error.
extend_args function¶
Extend arguments and keyword arguments with other arguments.
flat_ann_args_to_args function¶
Convert flattened annotated arguments back to positional and keyword arguments.
flatten_ann_args function¶
Flatten annotated arguments.
get_context_vars function¶
Get variables from the local/global context.
get_expr_var_names function¶
Get variable names listed in the expression.
get_forward_args function¶
Get positional and keyword arguments to forward.
get_func_arg_names function¶
Get argument names of a function.
get_func_kwargs function¶
Get keyword arguments with defaults of a function.
get_variable_args_name function¶
Get the name of variable positional arguments.
get_variable_kwargs_name function¶
Get the name of variable keyword arguments.
has_variable_args function¶
Return whether function accepts variable positions arguments.
has_variable_kwargs function¶
Return whether function accepts variable keyword arguments.
hash_args function¶
Get hash of arguments.
Use ignore_args to provide a sequence of queries for arguments that should be ignored.
ignore_flat_ann_args function¶
Ignore flattened annotated arguments.
match_and_set_flat_ann_arg function¶
Match an argument from flattened annotated arguments and set it to a new value.
See match_flat_ann_arg for matching logic.
match_ann_arg function¶
Match an argument from annotated arguments.
See match_flat_ann_arg for matching logic.
match_flat_ann_arg function¶
Match an argument from flattened annotated arguments.
A query can be an integer indicating the position of the argument, or a string containing the name of the argument, or a regular expression for matching the name of the argument.
If multiple arguments were matched, returns the first one.
The position can stretch over any variable argument.
suppress_stdout function¶
Suppress output from a function.
unflatten_ann_args function¶
Unflatten annotated arguments.
PrintsSuppressed class¶
Context manager to ignore print statements.
Superclasses
- Base
abc.ABCcontextlib.AbstractContextManagercontextlib._RedirectStreamcontextlib.redirect_stdout
Inherited members
Regex class¶
Class for matching a regular expression.
Superclasses
Inherited members
- Base.chat
- Base.find_api
- Base.find_assets
- Base.find_docs
- Base.find_examples
- Base.find_messages
- DefineMixin.asdict
- DefineMixin.assert_field_not_missing
- DefineMixin.fields
- DefineMixin.fields_dict
- DefineMixin.get_field
- DefineMixin.hash
- DefineMixin.hash_key
- DefineMixin.is_field_missing
- DefineMixin.is_field_optional
- DefineMixin.is_field_required
- DefineMixin.merge_over
- DefineMixin.merge_with
- DefineMixin.replace
- DefineMixin.resolve
- DefineMixin.resolve_field
- Hashable.get_hash
flags field¶
Flags.
matches method¶
Return whether the string matches the regular expression pattern.
pattern field¶
Pattern.
UnhashableArgsError class¶
Unhashable arguments error.
Superclasses
builtins.BaseExceptionbuiltins.Exception