From 5fbbdd994c49a7349bc185db7255e9e3f850dd3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 2 Aug 2023 12:06:21 +0200 Subject: [PATCH] docs: updating docstring, formatting --- .../data_service/data_service_list.py | 2 -- src/pyDataInterface/utils/helpers.py | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pyDataInterface/data_service/data_service_list.py b/src/pyDataInterface/data_service/data_service_list.py index 7166f6e..ac58e97 100644 --- a/src/pyDataInterface/data_service/data_service_list.py +++ b/src/pyDataInterface/data_service/data_service_list.py @@ -24,8 +24,6 @@ class DataServiceList(list): method. Attributes: - _original_list (list): - Reference to the original list, to prevent it from being garbage collected. callbacks (list): List of callback functions to be executed on item set. """ diff --git a/src/pyDataInterface/utils/helpers.py b/src/pyDataInterface/utils/helpers.py index c7493d9..645e323 100644 --- a/src/pyDataInterface/utils/helpers.py +++ b/src/pyDataInterface/utils/helpers.py @@ -77,8 +77,8 @@ def generate_paths_from_DataService_dict( list[str]: A list with paths as elements. Note: - The function ignores keys whose "type" is "method", as these represent methods of the - DataService object and not its state. + The function ignores keys whose "type" is "method", as these represent methods + of the DataService object and not its state. Example: ------- @@ -155,14 +155,18 @@ def get_nested_value_by_path_and_key(data: dict, path: str, key: str = "value") >>> data = { >>> "attr1": {"type": "int", "value": 10}, - >>> "attr2": {"type": "MyClass", "value": {"attr3": {"type": "float", "value": 20.5}}} + >>> "attr2": { + "type": "MyClass", + "value": {"attr3": {"type": "float", "value": 20.5}} + } >>> } The function can be used to get the value of 'attr1' as follows: >>> get_value_of_key_from_path(data, "attr1") 10 - It can also be used to get the value of 'attr3', which is nested within 'attr2', as follows: + It can also be used to get the value of 'attr3', which is nested within 'attr2', + as follows: >>> get_value_of_key_from_path(data, "attr2.attr3", "type") float """