Skip to content

Commit 34ce3f6

Browse files
crusaderkyjorenham
andauthored
TYP: type annotations (#135)
* TYP: type annotations * Python 3.9 fixes * self-review * code review * Update array_api_strict/_array_object.py Co-authored-by: Joren Hammudoglu <[email protected]> * Apply suggestions from code review Co-authored-by: Joren Hammudoglu <[email protected]> * fix * code review * fixes * normalize order * Fancy indexing in `__getitem__` signature * verbose Python scalar types --------- Co-authored-by: Joren Hammudoglu <[email protected]>
1 parent a8f567a commit 34ce3f6

24 files changed

+807
-716
lines changed

array_api_strict/__init__.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
1717
"""
1818

19+
from types import ModuleType
20+
1921
__all__ = []
2022

2123
# Warning: __array_api_version__ could change globally with
@@ -325,12 +327,16 @@
325327
ArrayAPIStrictFlags,
326328
)
327329

328-
__all__ += ['set_array_api_strict_flags', 'get_array_api_strict_flags', 'reset_array_api_strict_flags', 'ArrayAPIStrictFlags']
330+
__all__ += [
331+
'set_array_api_strict_flags',
332+
'get_array_api_strict_flags',
333+
'reset_array_api_strict_flags',
334+
'ArrayAPIStrictFlags',
335+
'__version__',
336+
]
329337

330338
try:
331-
from . import _version
332-
__version__ = _version.__version__
333-
del _version
339+
from ._version import __version__ # type: ignore[import-not-found,unused-ignore]
334340
except ImportError:
335341
__version__ = "unknown"
336342

@@ -340,7 +346,7 @@
340346
# use __getattr__. Note that linalg and fft are dynamically added and removed
341347
# from __all__ in set_array_api_strict_flags.
342348

343-
def __getattr__(name):
349+
def __getattr__(name: str) -> ModuleType:
344350
if name in ['linalg', 'fft']:
345351
if name in get_array_api_strict_flags()['enabled_extensions']:
346352
if name == 'linalg':

0 commit comments

Comments
 (0)