JeffersonLab / jlab_datascience_core

2 stars 1 forks source link

Get_info Implementation using DocStrings #17

Closed sgoldenCS closed 5 months ago

sgoldenCS commented 6 months ago

Having a get_info() method for each module class is only useful if you already know how to instantiate the module. If you do not know the proper arguments for instantiation, you can't call get_info(). Therefore, I propose that we write modules with python docstrings (description of docstrings can be found here: https://peps.python.org/pep-0257/). I believe these will also show up using python's built-in help() function so instantiation is not required to get the information. In order to have get_info() provide this docstring, we can utilize the inspect module using the inspect.getdoc() function. Printing the output of this function gives a prints a nice (cleaned) version of the docstring. "Cleaning" is done by inspect.cleandoc() which removes extra indentation and keep the docstring looking nice in both the code and the output.