[docstring]
This commit is contained in:
parent
af98fdc2cb
commit
cd7cd43313
@ -2,6 +2,15 @@ import nixio
|
|||||||
|
|
||||||
|
|
||||||
def create_metadata_from_dict(d: dict, section: nixio.Section) -> None:
|
def create_metadata_from_dict(d: dict, section: nixio.Section) -> None:
|
||||||
|
"""Creating nix section from dictionary.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
d : dict
|
||||||
|
Dictionary that needs to be saved to section
|
||||||
|
section : nixio.Section
|
||||||
|
Target section in Nix file
|
||||||
|
"""
|
||||||
for key, value in d.items():
|
for key, value in d.items():
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
new_sec = section.create_section(key, f"{type(key)}")
|
new_sec = section.create_section(key, f"{type(key)}")
|
||||||
@ -18,6 +27,18 @@ def create_metadata_from_dict(d: dict, section: nixio.Section) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def create_dict_from_section(section: nixio.Section) -> dict:
|
def create_dict_from_section(section: nixio.Section) -> dict:
|
||||||
|
"""Creating dictionary from Nix section
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
section : nixio.Section
|
||||||
|
Source nix section that will be exported to the dictionary
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
dict: dict
|
||||||
|
Nix section in a dictionary
|
||||||
|
"""
|
||||||
d = {}
|
d = {}
|
||||||
for key, value in section.items():
|
for key, value in section.items():
|
||||||
if isinstance(value, nixio.Section):
|
if isinstance(value, nixio.Section):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user