-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update dashboard __init__.py import * Add tooltips functionality to non-nested states * Add tooltips for the custom vselects * update type hints
- Loading branch information
Showing
4 changed files
with
89 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import inspect | ||
from typing import Dict, List, Type | ||
|
||
|
||
class InputDefaultsHelper: | ||
""" | ||
Methods in this class are used to dynamically parse | ||
core ImpactX data (default values, docstrings, etc.) | ||
""" | ||
|
||
@staticmethod | ||
def get_docstrings( | ||
class_names: List[Type], default_list: Dict[str, any] | ||
) -> Dict[str, str]: | ||
""" | ||
Retrieves docstrings for each method and property | ||
in the provided clases. | ||
:param classes: The class names to parse docstrings with. | ||
:param defaults_list: The dictionary of defaults value. | ||
""" | ||
|
||
docstrings = {} | ||
|
||
for each_class in class_names: | ||
for name, attribute in inspect.getmembers(each_class): | ||
if name not in default_list: | ||
continue | ||
|
||
is_method = inspect.isfunction(attribute) | ||
is_property = inspect.isdatadescriptor(attribute) | ||
|
||
if is_method or is_property: | ||
docstring = inspect.getdoc(attribute) or "" | ||
docstrings[name] = docstring | ||
|
||
return docstrings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters