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

Remove generate_stubs.py + hard-coded stubs #109

Merged
merged 12 commits into from
Mar 28, 2022
4 changes: 4 additions & 0 deletions .github/workflows/numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
# waiting on NumPy to allow/revert distinct NaNs for np.unique
# https://github.com/numpy/numpy/issues/20326#issuecomment-1012380448
array_api_tests/test_set_functions.py

# missing copy arg
array_api_tests/test_signatures.py::test_func_signature[reshape]

# https://github.com/numpy/numpy/issues/21211
array_api_tests/test_special_cases.py::test_iop[__iadd__(x1_i is -0 and x2_i is -0) -> -0]
# https://github.com/numpy/numpy/issues/21213
Expand Down
42 changes: 11 additions & 31 deletions array_api_tests/_array_module.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from importlib import import_module

from . import function_stubs
from . import stubs

# Replace this with a specific array module to test it, for example,
#
Expand Down Expand Up @@ -53,38 +53,18 @@ def __repr__(self):
__call__ = _raise
__getattr__ = _raise

_integer_dtypes = [
'int8',
'int16',
'int32',
'int64',
'uint8',
'uint16',
'uint32',
'uint64',
]

_floating_dtypes = [
'float32',
'float64',
]

_numeric_dtypes = [
*_integer_dtypes,
*_floating_dtypes,
]

_boolean_dtypes = [
'bool',
]

_dtypes = [
*_boolean_dtypes,
*_numeric_dtypes
"bool",
"uint8", "uint16", "uint32", "uint64",
"int8", "int16", "int32", "int64",
"float32", "float64",
]
_constants = ["e", "inf", "nan", "pi"]
_funcs = [f.__name__ for funcs in stubs.category_to_funcs.values() for f in funcs]
_top_level_attrs = _dtypes + _constants + _funcs + stubs.EXTENSIONS

for func_name in function_stubs.__all__ + _dtypes:
for attr in _top_level_attrs:
try:
globals()[func_name] = getattr(mod, func_name)
globals()[attr] = getattr(mod, attr)
except AttributeError:
globals()[func_name] = _UndefinedStub(func_name)
globals()[attr] = _UndefinedStub(attr)
62 changes: 0 additions & 62 deletions array_api_tests/function_stubs/__init__.py

This file was deleted.

41 changes: 0 additions & 41 deletions array_api_tests/function_stubs/_types.py

This file was deleted.

Loading