typedargs.utils module¶
Utility functions that are only used internally inside typedargs.
Summary¶
Classes:
BasicContext |
A Basic context for holding functions in a Hierarchical Shell. |
Functions:
call_with_optional_arg |
If func takes an argument, return func, otherwise return wrapped func to ignore the argument. |
context_name |
Given a context, return its proper name as a string. |
find_all |
Find all annotated function inside of a container. |
get_typing_type_args |
type_class must be type from typing module. |
get_typing_type_name |
type_class must be type from typing module. |
is_class_from_typing |
Check if the given type_class object is a class from typing module. |
Reference¶
-
class
typedargs.utils.
BasicContext
[source]¶ Bases:
dict
A Basic context for holding functions in a Hierarchical Shell.
-
typedargs.utils.
call_with_optional_arg
(func, *args)[source]¶ If func takes an argument, return func, otherwise return wrapped func to ignore the argument.
-
typedargs.utils.
find_all
(container)[source]¶ Find all annotated function inside of a container.
Annotated functions are identified as those that: - do not start with a _ character - are either annotated with metadata - or strings that point to lazily loaded modules
Parameters: container (object) – The container to search for annotated functions. Returns: A dict with all of the found functions in it. Return type: dict
-
typedargs.utils.
is_class_from_typing
(type_class)[source]¶ Check if the given type_class object is a class from typing module.