FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
array-api-tests/array_api_tests/_array_module.py at master · data-apis/array-api-tests · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
data-apis
/
array-api-tests
Public
Notifications
You must be signed in to change notification settings
Fork
52
Star
74
Code
Issues
49
Pull requests
10
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
array-api-tests
/
array_api_tests
/
_array_module.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (33 loc) · 1.24 KB
Breadcrumbs
array-api-tests
/
array_api_tests
/
_array_module.py
Copy path
File metadata and controls
42 lines (33 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from
.
import
stubs
,
xp
class
_UndefinedStub
:
"""
Standing for undefined names, so the tests can be imported even if they
fail
If this object appears in a test failure, it means a name is not defined
in a function. This typically happens for things like dtype literals not
being defined.
"""
def
__init__
(
self
,
name
):
self
.
name
=
name
def
_raise
(
self
,
*
args
,
**
kwargs
):
raise
AssertionError
(
f"
{
self
.
name
}
is not defined in
{
xp
.
__name__
}
"
)
def
__repr__
(
self
):
return
f"<undefined stub for
{
self
.
name
!r
}
>"
__call__
=
_raise
__getattr__
=
_raise
_dtypes
=
[
"bool"
,
"uint8"
,
"uint16"
,
"uint32"
,
"uint64"
,
"int8"
,
"int16"
,
"int32"
,
"int64"
,
"float32"
,
"float64"
,
"complex64"
,
"complex128"
,
]
_constants
=
[
"e"
,
"inf"
,
"nan"
,
"pi"
]
_funcs
=
[
f
.
__name__
for
funcs
in
stubs
.
category_to_funcs
.
values
()
for
f
in
funcs
]
_funcs
+=
[
"take"
,
"isdtype"
,
"conj"
,
"imag"
,
"real"
]
# TODO: bump spec and update array-api-tests to new spec layout
_top_level_attrs
=
_dtypes
+
_constants
+
_funcs
+
stubs
.
EXTENSIONS
+
[
"fft"
]
for
attr
in
_top_level_attrs
:
try
:
globals
()[
attr
]
=
getattr
(
xp
,
attr
)
except
AttributeError
:
globals
()[
attr
]
=
_UndefinedStub
(
attr
)
Back
|
FazBrowse Home
|
New Git URL