diff options
Diffstat (limited to 'numpy/array_api.py')
-rw-r--r-- | numpy/array_api.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/numpy/array_api.py b/numpy/array_api.py new file mode 100644 index 000000000..527ccc3fa --- /dev/null +++ b/numpy/array_api.py @@ -0,0 +1,24 @@ +import enum + +__all__ = [ + 'CopyMode' + ] + +class CopyMode(enum.Enum): + + ALWAYS = True + IF_NEEDED = False + NEVER = 2 + + def __bool__(self): + # For backwards compatiblity + if self == CopyMode.ALWAYS: + return True + + if self == CopyMode.IF_NEEDED: + return False + + raise TypeError(f"{self} is neither True nor False.") + + +CopyMode.__module__ = 'numpy.array_api' |