File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,27 @@ def _value_or_list_like_to_array(value_or_list_like, repeat=1):
2727 return out
2828
2929
30+ def _value_or_list_like_to_tuple (value_or_list_like , repeat = 1 ):
31+ """Convert an object which is either single value or a list-like to a tuple.
32+
33+ Parameters
34+ ----------
35+ value_or_list_like
36+ Single value or list-like.
37+ repeat : `obj`:`int`
38+ Size of resulting array if value is passed. If list is passed, it is ignored.
39+
40+ Returns
41+ -------
42+ out : `obj`:`tuple`
43+ When the input is a single value, returned an array with `repeat` samples
44+ containing that value. When the input is a list-like object, converts it to a
45+ tuple.
46+
47+ """
48+ return tuple (_value_or_list_like_to_array (value_or_list_like , repeat = repeat ))
49+
50+
3051def _raise_on_wrong_dtype (arr , dtype , name ):
3152 """Raises an error if dtype of `arr` is not a subdtype of `dtype`.
3253
You can’t perform that action at this time.
0 commit comments