-
Notifications
You must be signed in to change notification settings - Fork 1
sd_utils.plugins.plugin_manager
class PluginManager()
| @final
| register(name: str, on_register_params: dict = {}, **kwargs)
decorator for registering a plugin to this instance of a plugin manager
Arguments:
-
name
str - the name to register this plugin under -
**kwargs
- parameters to be passed to the plugin class when constructed
| @final
| run(name: str, on_search_params: dict = {}, on_find_params: dict = {}) -> Any
runs a given plugin.
Note: this function iterates over all plugins and will call the on_search for each plugin before executing the on_find hook for the plugin being searched for.
This function should not be used just to iterate over every plugin. instead the iterate_all function should be used
Arguments:
-
name
str - the name of the plugin to run -
on_search_params
dict - parameters to pass to the get_on_search_params function -
on_find_params
dict - parameters to pass to the get_on_find_params functions
Returns:
-
Any
- The value returned by running the to_find function of the called plugin
| @final
| iterate_all(on_iterate_params: dict = {})
Iterates over all the plugins without directly calling one of them. Only hook used is on_iterate
Arguments:
-
on_iterate_params
dict - a list of parameters to pass to the on_iterate hook
| get_on_search_params(name: str, **kwargs) -> Any
function that generates parameters for the on search function of a plugin given its name
Arguments:
-
name
str - the name of the command to call on_search for -
**kwargs
- any arguments sent from the run function
Returns:
-
Any
- the arguments to be sent to the on_search function
| get_on_find_params(name: str, **kwargs) -> Any
function that generates parameters for the on find function of a plugin given its name
Arguments:
-
name
str - the name of the command to call on_find for -
**kwargs
- any arguments sent from the run function
Returns:
-
Any
- the arguments to be sent to the on_find function
| get_on_register_params(name: str, **kwargs) -> Any
function that generates parameters for the on register function of a plugin given its name
Arguments:
-
name
str - the name of the command to call on_register for -
**kwargs
- any arguments sent from the register function
Returns:
-
Any
- the arguments to be sent to the on_register function
| get_on_iterate_params(name: str, **kwargs) -> Any
function that generates parameters for the on iterate_all function of a plugin given its name
Arguments:
-
name
str - the name of the command to call iterate_all for -
**kwargs
- any arguments sent from the iterate_all function
Returns:
-
Any
- the arguments to be sent to the iterate_all function