We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44e9299 commit e61b50dCopy full SHA for e61b50d
array_api_strict/_flags.py
@@ -277,6 +277,21 @@ def set_flags_from_environment():
277
278
set_flags_from_environment()
279
280
+# Decorators
281
+
282
+def requires_api_version(version):
283
+ def decorator(func):
284
+ @functools.wraps(func)
285
+ def wrapper(*args, **kwargs):
286
+ if version > API_VERSION:
287
+ raise RuntimeError(
288
+ f"The function {func.__name__} requires API version {version} or later, "
289
+ f"but the current API version for array-api-strict is {API_VERSION}"
290
+ )
291
+ return func(*args, **kwargs)
292
+ return wrapper
293
+ return decorator
294
295
def requires_data_dependent_shapes(func):
296
@functools.wraps(func)
297
def wrapper(*args, **kwargs):
0 commit comments