Skip to content

Commit

Permalink
updated docstrings and added check for dict keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 committed Sep 29, 2022
1 parent ac74749 commit 088d322
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyxdsm/XDSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down

0 comments on commit 088d322

Please sign in to comment.