From 088d32295b102701dc10a73836919fe04e1d5821 Mon Sep 17 00:00:00 2001 From: Neil Wu <602725+nwu63@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:38:19 -0400 Subject: [PATCH] updated docstrings and added check for dict keys --- pyxdsm/XDSM.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyxdsm/XDSM.py b/pyxdsm/XDSM.py index 4372fe6..2f7a391 100644 --- a/pyxdsm/XDSM.py +++ b/pyxdsm/XDSM.py @@ -128,7 +128,7 @@ def __init__(self, use_sfmath=True, optional_latex_packages=None, auto_fade=None optional_latex_packages : string or list of strings, optional Additional latex packages to use when creating the pdf and tex versions of the diagram, by default None auto_fade : dictionary, optional - For each key "inputs", "outputs", "connections", the value can be one of: + For each key "inputs", "outputs", "connections", and "processes", the value can be one of: - "all" : fade all blocks - "unconnected" : fade all components connected to faded blocks - "none" : do not auto-fade anything @@ -152,6 +152,12 @@ def __init__(self, use_sfmath=True, optional_latex_packages=None, auto_fade=None raise ValueError("optional_latex_packages must be a string or a list of strings") if auto_fade is None: auto_fade = {"inputs": "none", "outputs": "none", "connections": "none", "processes": "none"} + else: + if set(auto_fade.keys()) != {"inputs", "outputs", "connections", "processes"}: + raise ValueError( + "The supplied 'auto_fade' dictionary does not contain all the expected keys. " + + "Need to provide keys for 'inputs', 'outputs', 'connections', 'processes'." + ) self.auto_fade = auto_fade def add_system(