Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add raises NotImplementedError for array creation functions #1695

Merged
merged 6 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"asnumpy",
"astype",
"check_supported_arrays_type",
"check_limitations",
"convert_single_elem_array_to_scalar",
"default_float_type",
"dpnp_queue_initialize",
Expand Down Expand Up @@ -241,6 +242,37 @@ def check_supported_arrays_type(*arrays, scalar_type=False):
return True


def check_limitations(order=None, subok=False, like=None):
npolina4 marked this conversation as resolved.
Show resolved Hide resolved
"""
Checking limitation kwargs for their supported values.

Parameter `order` is supported only with values ``"C"``, ``"F"`` and ``None``.
Parameter `subok` is supported only with default value ``False``.
Parameter `like` is supported only with default value ``None``.

Raises
------
NotImplementedError
If any input kwargs is of unsupported value.
"""

if order not in ("C", "c", "F", "f", None):
raise NotImplementedError(
"Keyword argument `order` is supported only with "
f"values ``'C'`` and ``'F'``, but got {order}"
)
elif like is not None:
raise NotImplementedError(
"Keyword argument `like` is supported only with "
f"default value ``None``, but got {like}"
)
elif subok is not False:
raise NotImplementedError(
"Keyword argument `subok` is supported only with "
f"default value ``False``, but got {subok}"
)


def convert_single_elem_array_to_scalar(obj, keepdims=False):
"""Convert array with single element to scalar."""

Expand Down
Loading
Loading