diff --git a/peekingduck/configloader.py b/peekingduck/configloader.py index 6056c7148..b46c4b5c7 100644 --- a/peekingduck/configloader.py +++ b/peekingduck/configloader.py @@ -23,8 +23,16 @@ class ConfigLoader: # pylint: disable=too-few-public-methods - """ Reads configuration and returns configuration required to - create the nodes for the project + """ + A helper class to create pipeline. + + The config loader class is used to allow for instantiation of Node classes + directly instead of reading configurations from the run config yaml. + + Args: + + basedir (:obj:`str`): base directory of peekingduck + """ def __init__(self, basedir: str) -> None: @@ -41,8 +49,18 @@ def _get_config_path(self, node: str) -> str: return filepath def get(self, node_name: str) -> Dict[str, Any]: - """Get item from configuration read from the filepath, - item refers to the node item configuration you are trying to get""" + """ + Get node configuration for specified node. + + Args: + + node_name (:obj:`str`): name of node + + Outputs: + node_config (:obj:`Dict`): dictionary of node configurations for the + specified node + + """ filepath = self._get_config_path(node_name) diff --git a/peekingduck/declarative_loader.py b/peekingduck/declarative_loader.py index ca4612717..15dd182bb 100644 --- a/peekingduck/declarative_loader.py +++ b/peekingduck/declarative_loader.py @@ -35,7 +35,28 @@ class DeclarativeLoader: # pylint: disable=too-few-public-methods - """Uses the declarative run_config.yml to load pipelines or compiled configs""" + """ + A helper class to create pipeline. + + The declarative loader class creates the specified nodes according to any + modfications provided in the configs and returns the pipeline needed for + inference. + + Args: + + run_config (:obj:`str`): Path to yaml file that declares the node \ + sequence to be used in the pipeline + + config_updates_cli (:obj:`str`): stringified nested dictionaries of \ + config changes passed as part of cli command. Used to modify the node \ + configurations direct from cli. + + custom_node_parent_folder (:obj:`str`): path to parent folder which contains \ + custom nodes that users have created to be used with PeekingDuck. \ + For more information on using custom nodes, please refer to \ + `getting started `_. + + """ def __init__(self, run_config: str, diff --git a/peekingduck/runner.py b/peekingduck/runner.py index 7b855be47..e80012c73 100644 --- a/peekingduck/runner.py +++ b/peekingduck/runner.py @@ -26,7 +26,30 @@ class Runner(): - """Runner class that uses the declared nodes to create pipeline to run inference + """ + The runner class for creation of pipeline using declared/given nodes. + + The runner class uses the provided configurations to setup a node pipeline + which is used to run inference. + + Args: + + RUN_PATH (:obj:`str`): If path to a run_config.yml is provided, uses \ + our declarative loader to load the yaml file according to our specified \ + schema to obtain the declared nodes that would be sequentially \ + initialized and used to create the pipeline for running inference. \ + + config_updates_cli (:obj:`str`): config changes passed as part of the \ + cli command sed to modify the node configurations direct from cli. + + CUSTOM_NODE_PARENT_FOLDER (:obj:`str`): path to folder which contains \ + custom nodes that users have created to be used with PeekingDuck. \ + For more information on using custom nodes, please refer to \ + `getting started `_. + + nodes (:obj:`list` of :obj:`Node`): if not using declarations via yaml, \ + initialize by giving the node stack directly as a list. + """ def __init__(self, @@ -34,15 +57,6 @@ def __init__(self, config_updates_cli: str = None, CUSTOM_NODE_PARENT_FOLDER: str = None, nodes: List[AbstractNode] = None): - """ - Args: - RUN_PATH (str): path to yaml file of node pipeine declaration. - config_updates_cli (str): stringified nested dictionaries of configs. - CUSTOM_NODE_PARENT_FOLDER (str): parent folder of the custom nodes folder. - nodes (:obj:'list' of :obj:'Node'): if not using declarations via yaml, - initialize by giving the node stack as a list - - """ self.logger = logging.getLogger(__name__) @@ -86,6 +100,6 @@ def get_run_config(self) -> List[str]: """retrieve run configs Returns: - Dict[Any]: run configs being used for runner + (:obj:`Dict`: run configs being used for runner """ return self.node_loader.node_list