Skip to content

Commit b8a4b73

Browse files
Unify type exports in __init__.py and remove wildcard import
1 parent 7cbc63a commit b8a4b73

File tree

2 files changed

+75
-55
lines changed

2 files changed

+75
-55
lines changed

dpnp/__init__.py

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
from .dpnp_array import dpnp_array as ndarray
6767
from .dpnp_array_api_info import __array_namespace_info__
6868
from .dpnp_flatiter import flatiter as flatiter
69-
from .dpnp_iface_types import *
7069
from .dpnp_iface_utils import *
7170
from .dpnp_iface_utils import __all__ as _ifaceutils__all__
7271
from ._version import get_versions
@@ -77,6 +76,81 @@
7776
from . import scipy as scipy
7877

7978

79+
# =============================================================================
80+
# Data types, constants and type-related helpers
81+
# =============================================================================
82+
83+
# -----------------------------------------------------------------------------
84+
# Data types (borrowed from NumPy)
85+
#
86+
# The order of these declarations are borrowed from the NumPy document:
87+
# https://numpy.org/doc/stable/reference/arrays.scalars.html
88+
# -----------------------------------------------------------------------------
89+
from .dpnp_iface_types import (
90+
bool,
91+
bool_,
92+
byte,
93+
cdouble,
94+
complex128,
95+
complex64,
96+
complexfloating,
97+
csingle,
98+
double,
99+
dtype,
100+
float16,
101+
float32,
102+
float64,
103+
floating,
104+
inexact,
105+
int_,
106+
int8,
107+
int16,
108+
int32,
109+
int64,
110+
integer,
111+
intc,
112+
intp,
113+
longlong,
114+
number,
115+
short,
116+
signedinteger,
117+
single,
118+
ubyte,
119+
uint8,
120+
uint16,
121+
uint32,
122+
uint64,
123+
uintc,
124+
uintp,
125+
unsignedinteger,
126+
ushort,
127+
ulonglong,
128+
)
129+
130+
# -----------------------------------------------------------------------------
131+
# Constants (borrowed from NumPy)
132+
# -----------------------------------------------------------------------------
133+
from .dpnp_iface_types import (
134+
e,
135+
euler_gamma,
136+
inf,
137+
nan,
138+
newaxis,
139+
pi,
140+
)
141+
142+
# -----------------------------------------------------------------------------
143+
# Type-related helper functions
144+
# -----------------------------------------------------------------------------
145+
from .dpnp_iface_types import (
146+
common_type,
147+
finfo,
148+
iinfo,
149+
isdtype,
150+
issubdtype,
151+
is_type_supported,
152+
)
153+
80154
# =============================================================================
81155
# Routines
82156
#

dpnp/dpnp_iface_types.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -47,60 +47,6 @@
4747
# pylint: disable=no-name-in-module
4848
from .dpnp_utils import get_usm_allocations
4949

50-
__all__ = [
51-
"bool",
52-
"bool_",
53-
"byte",
54-
"cdouble",
55-
"common_type",
56-
"complex128",
57-
"complex64",
58-
"complexfloating",
59-
"csingle",
60-
"double",
61-
"dtype",
62-
"e",
63-
"euler_gamma",
64-
"finfo",
65-
"float16",
66-
"float32",
67-
"float64",
68-
"floating",
69-
"iinfo",
70-
"inexact",
71-
"inf",
72-
"int_",
73-
"int8",
74-
"int16",
75-
"int32",
76-
"int64",
77-
"integer",
78-
"intc",
79-
"intp",
80-
"isdtype",
81-
"issubdtype",
82-
"is_type_supported",
83-
"longlong",
84-
"nan",
85-
"newaxis",
86-
"number",
87-
"pi",
88-
"short",
89-
"signedinteger",
90-
"single",
91-
"ubyte",
92-
"uint8",
93-
"uint16",
94-
"uint32",
95-
"uint64",
96-
"uintc",
97-
"uintp",
98-
"unsignedinteger",
99-
"ushort",
100-
"ulonglong",
101-
]
102-
103-
10450
# pylint: disable=invalid-name
10551
# =============================================================================
10652
# Data types (borrowed from NumPy)

0 commit comments

Comments
 (0)