We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent afccf29 commit 2395ea0Copy full SHA for 2395ea0
1 file changed
array_api_compat/_internal.py
@@ -5,6 +5,7 @@
5
from functools import wraps
6
from inspect import signature
7
8
+
9
def get_xp(xp):
10
"""
11
Decorator to automatically replace xp with the corresponding array module.
@@ -41,3 +42,16 @@ def wrapped_f(*args, **kwargs):
41
42
return wrapped_f
43
44
return inner
45
46
47
+def get_all_public_members(module, filter_=None):
48
+ """Get all public members of a module."""
49
+ try:
50
+ return getattr(module, '__all__')
51
+ except AttributeError:
52
+ pass
53
54
+ if filter_ is None:
55
+ filter_ = lambda name: name.startswith('_') # noqa: E731
56
57
+ return map(dir(module), filter_)
0 commit comments