From eafcee4b97504f1bb65c8a62439a25e38d0e6137 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Thu, 13 Jun 2019 19:19:19 +0100 Subject: plugin: remove 'node_get_list_element' The new yaml API is able of getting these access with the same error messages handling. Having this helper is therefore not useful anymore. --- src/buildstream/plugin.py | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'src/buildstream/plugin.py') diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py index 787b414cf..47b97441d 100644 --- a/src/buildstream/plugin.py +++ b/src/buildstream/plugin.py @@ -281,8 +281,7 @@ class Plugin(): data and store it. Plugins should use the :func:`Plugin.node_get_member() ` - and :func:`Plugin.node_get_list_element() ` - methods to fetch values from the passed `node`. This will ensure that a nice human readable error + method to fetch values from the passed `node`. This will ensure that a nice human readable error message will be raised if the expected configuration is not found, indicating the filename, line and column numbers. @@ -529,41 +528,6 @@ class Plugin(): """ _yaml.node_validate(node, valid_keys) - def node_get_list_element(self, node, expected_type, member_name, indices): - """Fetch the value of a list element from a node member, raising an error if the - value is incorrectly typed. - - Args: - node (dict): A dictionary loaded from YAML - expected_type (type): The expected type of the node member - member_name (str): The name of the member to fetch - indices (list of int): List of indices to search, in case of nested lists - - Returns: - The value of the list element in *member_name* at the specified *indices* - - Raises: - :class:`.LoadError` - - Note: - Returned strings are stripped of leading and trailing whitespace - - **Example:** - - .. code:: python - - # Fetch the list itself - things = self.node_get_member(node, list, 'things') - - # Iterate over the list indices - for i in range(len(things)): - - # Fetch dict things - thing = self.node_get_list_element( - node, dict, 'things', [ i ]) - """ - return _yaml.node_get(node, expected_type, member_name, indices=indices) - def debug(self, brief, *, detail=None): """Print a debugging message -- cgit v1.2.1