Skip to content

Commit

Permalink
Add info to docstrings of the functions of submodule core.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayitzin committed Apr 14, 2023
1 parent ee45dca commit 41d39e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ahrs/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
import numpy as np

def _assert_valid_array_type(item, item_name: str = 'iterable'):
"""Assert it is an iterable"""
"""Assert it is a list, tuple, or numpy array"""
# NOTE: This could be changed to a more pythonic solution looking for the
# dunder method __iter__(), but that yields strings too.
if not isinstance(item, (list, tuple, np.ndarray)):
raise TypeError(f"{item_name} must be given as an array. Got {type(item)}")

def _assert_numerical_iterable(item, item_name: str = 'iterable'):
"""Assert it is a list, tuple, or numpy array, and that it has numerical values"""
_assert_valid_array_type(item, item_name)
item_copy = np.copy(item)
if not(item_copy.dtype == np.dtype(int) or item_copy.dtype == np.dtype(float)):
Expand Down

0 comments on commit 41d39e6

Please sign in to comment.