Skip to content

Commit 73e998e

Browse files
committed
TYP: type annotations
1 parent a8f567a commit 73e998e

22 files changed

+746
-685
lines changed

array_api_strict/__init__.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
consuming libraries to test their array API usage.
1616
1717
"""
18+
from types import ModuleType
1819

1920
__all__ = []
2021

@@ -122,7 +123,7 @@
122123
"bool",
123124
]
124125

125-
from ._elementwise_functions import (
126+
from ._elementwise_functions import ( # type: ignore[attr-defined]
126127
abs,
127128
acos,
128129
acosh,
@@ -325,12 +326,16 @@
325326
ArrayAPIStrictFlags,
326327
)
327328

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

330337
try:
331-
from . import _version
332-
__version__ = _version.__version__
333-
del _version
338+
from ._version import __version__ # type: ignore[import-not-found,unused-ignore]
334339
except ImportError:
335340
__version__ = "unknown"
336341

@@ -340,7 +345,7 @@
340345
# use __getattr__. Note that linalg and fft are dynamically added and removed
341346
# from __all__ in set_array_api_strict_flags.
342347

343-
def __getattr__(name):
348+
def __getattr__(name: str) -> ModuleType:
344349
if name in ['linalg', 'fft']:
345350
if name in get_array_api_strict_flags()['enabled_extensions']:
346351
if name == 'linalg':

0 commit comments

Comments
 (0)