Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert docstrings to numpydoc style #140

Merged
merged 43 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4d6a9a8
add numpydoc dependency
rocco8773 Jul 3, 2024
96b69e2
add numpydoc extension to conf.py
rocco8773 Jul 3, 2024
e0f9007
fix typo
rocco8773 Jul 3, 2024
28b4642
convert docstrings to numpydoc style
rocco8773 Jul 3, 2024
14e6bd8
configure numpydoc to not show inherited members by default
rocco8773 Jul 3, 2024
a142653
configure numpydoc to not show inherited members by default
rocco8773 Jul 3, 2024
84aad81
move examples to the __init__ docstring
rocco8773 Jul 3, 2024
3623900
it's note plural !
rocco8773 Jul 3, 2024
80ccda5
use sphinx.ext.napoleon instead of numpydoc
rocco8773 Jul 3, 2024
c06deec
remove vestiges of the numpy extension
rocco8773 Jul 3, 2024
22e4a83
convert docstrings to numpydoc style
rocco8773 Jul 4, 2024
5c8dcae
indent docstring code block
rocco8773 Jul 4, 2024
921eea6
convert docstrings to numpydoc style
rocco8773 Jul 4, 2024
28b7e3a
convert docstrings to numpydoc style
rocco8773 Jul 4, 2024
431bfaa
fix typo
rocco8773 Jul 4, 2024
4b2979b
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
32ea81f
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
1a7ff17
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
7788eca
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
fdd5d6b
fix typo
rocco8773 Jul 8, 2024
29cbadb
fix line length issues
rocco8773 Jul 8, 2024
4be6389
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
266e7cd
trying to get HDFReadMsi to intersphinx link
rocco8773 Jul 8, 2024
09a99dc
get return types to intersphinx link
rocco8773 Jul 8, 2024
f16e1fa
get param types to intersphinx link
rocco8773 Jul 8, 2024
fb34000
fix docstring typo errors
rocco8773 Jul 8, 2024
c26c4ac
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
db09c0d
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
5aa032e
convert docstrings to numpydoc style
rocco8773 Jul 8, 2024
a785046
trying to break the .. note:: from the Returns section
rocco8773 Jul 8, 2024
3809105
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
3f4a566
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
c8245fe
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
1deea61
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
c9f0821
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
6b5a95f
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
4add26b
convert docstring to numpydoc style
rocco8773 Jul 8, 2024
8af449f
convert docstring to numpydoc style, :code:`` -> `` ``
rocco8773 Jul 9, 2024
27d4185
add changelog entries
rocco8773 Jul 9, 2024
6287252
appease grumpy black
rocco8773 Jul 9, 2024
c08d7bf
appease grumpy codespell
rocco8773 Jul 9, 2024
e56b22c
add numpydoc to intersphinx mappings
rocco8773 Jul 9, 2024
aa9924c
replace double backslashes with single backslashes
rocco8773 Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions bapsflib/_hdf/maps/controls/map_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ class HDFMapControls(dict):
A dictionary that contains mapping objects for all the discovered
control devices in the HDF5 data group. The dictionary keys are
the names of the discovered control devices.

:Example:

>>> from bapsflib import lapd
>>> from bapsflib._hdf.maps import HDFMapControls
>>> f = lapd.File('sample.hdf5')
>>> # 'Raw data + config' is the LaPD HDF5 group name for the
... # group housing digitizer and control devices
... control_map = HDFMapControls(f['Raw data + config'])
>>> control_map['6K Compumotor']
<bapsflib._hdf.maps.controls.sixk.HDFMapControl6K>
"""

_defined_mapping_classes = {
Expand All @@ -62,7 +51,22 @@ class HDFMapControls(dict):

def __init__(self, data_group: h5py.Group):
"""
:param data_group: HDF5 group object
Parameters
----------
data_group : `h5py.Group`
HDF5 group object to be mapped

Examples
--------

>>> from bapsflib import lapd
>>> from bapsflib._hdf.maps import HDFMapControls
>>> f = lapd.File('sample.hdf5')
>>> # 'Raw data + config' is the LaPD HDF5 group name for the
... # group housing digitizer and control devices
... control_map = HDFMapControls(f['Raw data + config'])
>>> control_map['6K Compumotor']
<bapsflib._hdf.maps.controls.sixk.HDFMapControl6K>
"""
# condition data_group arg
if not isinstance(data_group, h5py.Group):
Expand Down Expand Up @@ -100,10 +104,12 @@ def __build_dict(self) -> Dict[str, ControlMap]:
"""
Discovers the HDF5 control devices and builds the dictionary
containing the control device mapping objects. This is the
dictionary used to initialize :code:`self`.
dictionary used to initialize ``self``.

:return: control device mapping dictionary
:rtype: dict
Returns
-------
dict
control device mapping dictionary
"""
control_dict = {}
for name in self.data_group_subgnames:
Expand Down
5 changes: 4 additions & 1 deletion bapsflib/_hdf/maps/controls/n5700ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class HDFMapControlN5700PS(HDFMapControlCLTemplate):

def __init__(self, group: h5py.Group):
"""
:param group: the HDF5 control device group
Parameters
----------
group : `h5py.Group`
the HDF5 control device group
"""
# initialize
HDFMapControlCLTemplate.__init__(self, group)
Expand Down
5 changes: 4 additions & 1 deletion bapsflib/_hdf/maps/controls/nixyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ class HDFMapControlNIXYZ(HDFMapControlTemplate):

def __init__(self, group: h5py.Group):
"""
:param group: the HDF5 control device group
Parameters
----------
group : `h5py.Group`
the HDF5 control device group
"""
HDFMapControlTemplate.__init__(self, group)

Expand Down
5 changes: 4 additions & 1 deletion bapsflib/_hdf/maps/controls/nixz.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ class HDFMapControlNIXZ(HDFMapControlTemplate):

def __init__(self, group: h5py.Group):
"""
:param group: the HDF5 control device group
Parameters
----------
group : `h5py.Group`
the HDF5 control device group
"""
HDFMapControlTemplate.__init__(self, group)

Expand Down
35 changes: 25 additions & 10 deletions bapsflib/_hdf/maps/controls/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ class CLParse(object):

def __init__(self, command_list: Union[str, Iterable[str]]):
"""
:param command_list: the command list for a control device
:type command_list: list of strings
Parameters
----------
command_list : Union[str, Iterable[str]]
the command list for a control device
"""
super().__init__()

Expand All @@ -56,15 +58,26 @@ def __init__(self, command_list: Union[str, Iterable[str]]):

def apply_patterns(self, patterns: Union[str, Iterable[str]]):
"""
Applies a the REs defined in `patterns` to parse the command
list.
Applies the regular expressions defined in `patterns` to parse
the command list.

:param patterns: list or raw strings defining REs for parsing
Parameters
----------
patterns : Union[str, Iterable[str]]
list of raw strings defining regular expressions for parsing
the command list
:type patterns: str or list of strings
:return: (bool, dict)

:Example:
Returns
-------
bool
`True` if the command list is parsed successfully, `False`
otherwise.

dict
results from the command list parsing

Examples
--------

>>> # define a command list
>>> cl = ['VOLT 20.0', 'VOLT 25.0', 'VOLT 30.0']
Expand Down Expand Up @@ -275,9 +288,11 @@ def try_patterns(self, patterns: Union[str, Iterable[str]]):
Prints to the results of applying the REs in patterns to the
command list. Pretty print of :meth:`apply_patterns`.

:param patterns: list or raw strings defining REs for parsing
Parameters
----------
patterns : Union[str, Iterable[str]]
list of raw strings defining regular expressions for parsing
the command list
:type patterns: str or list of strings
"""
# TODO: clean method and format print better
#
Expand Down
27 changes: 22 additions & 5 deletions bapsflib/_hdf/maps/controls/sixk.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class HDFMapControl6K(HDFMapControlTemplate):

def __init__(self, group: h5py.Group):
"""
:param group: the HDF5 control device group
Parameters
----------
group : `h5py.Group`
the HDF5 control device group
"""
HDFMapControlTemplate.__init__(self, group)

Expand Down Expand Up @@ -212,8 +215,15 @@ def _analyze_motionlist(self, gname: str) -> dict:
Determines if `gname` matches the RE for a motion list group
name. It yes, then it gathers the motion list info.

:param str gname: name of potential motion list group
:return: dictionary with `'name'` and `'config'` keys
Parameters
----------
gname : `str`
name of potential motion list group

Returns
-------
dict
dictionary with ``'name'`` and ``'config'`` keys
"""
# Define RE pattern
# - A motion list group follows the naming scheme of:
Expand Down Expand Up @@ -340,8 +350,15 @@ def _analyze_probelist(self, gname: str) -> dict:
Determines if `gname` matches the RE for a probe list group
name. If yes, then it gathers the probe info.

:param str gname: name of potential probe list group
:return: dictionary with `'probe-id'` and `'config'` keys
Parameters
----------
gname : `str`
name of potential probe list group

Returns
-------
dict
dictionary with ``'probe-id'`` and ``'config'`` keys
"""
# Define RE pattern
# - A probe list group follows the naming scheme of:
Expand Down
Loading