|
99 | 99 | ] |
100 | 100 |
|
101 | 101 |
|
102 | | -def _check_limitations(order=None, subok=False, like=None): |
103 | | - """ |
104 | | - Checking limitation kwargs for their supported values. |
105 | | -
|
106 | | - Parameter `order` is supported only with values ``C``, ``F`` and ``None``. |
107 | | - Parameter `subok` is supported only with default value ``False``. |
108 | | - Parameter `like` is supported only with default value ``None``. |
109 | | -
|
110 | | - Raises |
111 | | - ------ |
112 | | - NotImplementedError |
113 | | - If any input kwargs is of unsupported value. |
114 | | -
|
115 | | - """ |
116 | | - |
117 | | - if order in ("A", "a", "K", "k"): |
118 | | - raise NotImplementedError( |
119 | | - "Keyword argument `order` is supported only with " |
120 | | - f"values ``'C'`` and ``'F'``, but got {order}" |
121 | | - ) |
122 | | - if order not in ("C", "c", "F", "f", None): |
123 | | - raise ValueError( |
124 | | - "Unrecognized `order` keyword value, expecting " |
125 | | - f"``'C'`` or ``'F'``, but got {order}" |
126 | | - ) |
127 | | - if like is not None: |
128 | | - raise NotImplementedError( |
129 | | - "Keyword argument `like` is supported only with " |
130 | | - f"default value ``None``, but got {like}" |
131 | | - ) |
132 | | - if subok is not False: |
133 | | - raise NotImplementedError( |
134 | | - "Keyword argument `subok` is supported only with " |
135 | | - f"default value ``False``, but got {subok}" |
136 | | - ) |
137 | | - |
138 | | - |
139 | 102 | def arange( |
140 | 103 | start, |
141 | 104 | /, |
@@ -223,7 +186,7 @@ def arange( |
223 | 186 |
|
224 | 187 | """ |
225 | 188 |
|
226 | | - _check_limitations(like=like) |
| 189 | + dpnp.check_limitations(like=like) |
227 | 190 |
|
228 | 191 | return dpnp_container.arange( |
229 | 192 | start, |
@@ -343,7 +306,7 @@ def array( |
343 | 306 |
|
344 | 307 | """ |
345 | 308 |
|
346 | | - _check_limitations(subok=subok, like=like) |
| 309 | + dpnp.check_limitations(subok=subok, like=like) |
347 | 310 | if ndmin != 0: |
348 | 311 | raise NotImplementedError( |
349 | 312 | "Keyword argument `ndmin` is supported only with " |
@@ -451,7 +414,7 @@ def asanyarray( |
451 | 414 |
|
452 | 415 | """ |
453 | 416 |
|
454 | | - _check_limitations(like=like) |
| 417 | + dpnp.check_limitations(like=like) |
455 | 418 |
|
456 | 419 | return asarray( |
457 | 420 | a, |
@@ -548,7 +511,7 @@ def asarray( |
548 | 511 |
|
549 | 512 | """ |
550 | 513 |
|
551 | | - _check_limitations(like=like) |
| 514 | + dpnp.check_limitations(like=like) |
552 | 515 |
|
553 | 516 | return dpnp_container.asarray( |
554 | 517 | a, |
@@ -654,7 +617,7 @@ def ascontiguousarray( |
654 | 617 |
|
655 | 618 | """ |
656 | 619 |
|
657 | | - _check_limitations(like=like) |
| 620 | + dpnp.check_limitations(like=like) |
658 | 621 |
|
659 | 622 | # at least 1-d array has to be returned |
660 | 623 | if dpnp.isscalar(a) or hasattr(a, "ndim") and a.ndim == 0: |
@@ -768,7 +731,7 @@ def asfortranarray( |
768 | 731 |
|
769 | 732 | """ |
770 | 733 |
|
771 | | - _check_limitations(like=like) |
| 734 | + dpnp.check_limitations(like=like) |
772 | 735 |
|
773 | 736 | # at least 1-d array has to be returned |
774 | 737 | if dpnp.isscalar(a) or hasattr(a, "ndim") and a.ndim == 0: |
@@ -867,7 +830,7 @@ def copy( |
867 | 830 |
|
868 | 831 | """ |
869 | 832 |
|
870 | | - _check_limitations(subok=subok) |
| 833 | + dpnp.check_limitations(subok=subok) |
871 | 834 |
|
872 | 835 | if dpnp.is_supported_array_type(a): |
873 | 836 | sycl_queue_normalized = dpnp.get_normalized_queue_device( |
@@ -1176,7 +1139,7 @@ def empty( |
1176 | 1139 |
|
1177 | 1140 | """ |
1178 | 1141 |
|
1179 | | - _check_limitations(order=order, like=like) |
| 1142 | + dpnp.check_limitations(order=order, like=like) |
1180 | 1143 | return dpnp_container.empty( |
1181 | 1144 | shape, |
1182 | 1145 | dtype=dtype, |
@@ -1276,7 +1239,7 @@ def empty_like( |
1276 | 1239 | """ |
1277 | 1240 |
|
1278 | 1241 | dpnp.check_supported_arrays_type(a) |
1279 | | - _check_limitations(order=order, subok=subok) |
| 1242 | + dpnp.check_limitations(order=order, subok=subok) |
1280 | 1243 |
|
1281 | 1244 | _shape = a.shape if shape is None else shape |
1282 | 1245 | _dtype = a.dtype if dtype is None else dtype |
@@ -1385,7 +1348,7 @@ def eye( |
1385 | 1348 |
|
1386 | 1349 | """ |
1387 | 1350 |
|
1388 | | - _check_limitations(order=order, like=like) |
| 1351 | + dpnp.check_limitations(order=order, like=like) |
1389 | 1352 |
|
1390 | 1353 | return dpnp_container.eye( |
1391 | 1354 | N, |
@@ -1485,7 +1448,7 @@ def frombuffer( |
1485 | 1448 |
|
1486 | 1449 | """ |
1487 | 1450 |
|
1488 | | - _check_limitations(like=like) |
| 1451 | + dpnp.check_limitations(like=like) |
1489 | 1452 | return asarray( |
1490 | 1453 | numpy.frombuffer(buffer, dtype=dtype, count=count, offset=offset), |
1491 | 1454 | device=device, |
@@ -1609,7 +1572,7 @@ def fromfile( |
1609 | 1572 |
|
1610 | 1573 | """ |
1611 | 1574 |
|
1612 | | - _check_limitations(like=like) |
| 1575 | + dpnp.check_limitations(like=like) |
1613 | 1576 | return asarray( |
1614 | 1577 | numpy.fromfile(file, dtype=dtype, count=count, sep=sep, offset=offset), |
1615 | 1578 | device=device, |
@@ -1725,7 +1688,7 @@ def fromstring( |
1725 | 1688 |
|
1726 | 1689 | """ |
1727 | 1690 |
|
1728 | | - _check_limitations(like=like) |
| 1691 | + dpnp.check_limitations(like=like) |
1729 | 1692 | return asarray( |
1730 | 1693 | numpy.fromstring(string, dtype=dtype, count=count, sep=sep), |
1731 | 1694 | device=device, |
@@ -1819,7 +1782,7 @@ def full( |
1819 | 1782 |
|
1820 | 1783 | """ |
1821 | 1784 |
|
1822 | | - _check_limitations(order=order, like=like) |
| 1785 | + dpnp.check_limitations(order=order, like=like) |
1823 | 1786 |
|
1824 | 1787 | return dpnp_container.full( |
1825 | 1788 | shape, |
@@ -1926,7 +1889,7 @@ def full_like( |
1926 | 1889 | """ |
1927 | 1890 |
|
1928 | 1891 | dpnp.check_supported_arrays_type(a) |
1929 | | - _check_limitations(order=order, subok=subok) |
| 1892 | + dpnp.check_limitations(order=order, subok=subok) |
1930 | 1893 |
|
1931 | 1894 | _shape = a.shape if shape is None else shape |
1932 | 1895 | _dtype = a.dtype if dtype is None else dtype |
@@ -2155,7 +2118,7 @@ def identity( |
2155 | 2118 | if n < 0: |
2156 | 2119 | raise ValueError("negative dimensions are not allowed") |
2157 | 2120 |
|
2158 | | - _check_limitations(like=like) |
| 2121 | + dpnp.check_limitations(like=like) |
2159 | 2122 |
|
2160 | 2123 | _dtype = dpnp.default_float_type() if dtype is None else dtype |
2161 | 2124 | return dpnp.eye( |
@@ -2759,7 +2722,7 @@ def ones( |
2759 | 2722 |
|
2760 | 2723 | """ |
2761 | 2724 |
|
2762 | | - _check_limitations(order=order, like=like) |
| 2725 | + dpnp.check_limitations(order=order, like=like) |
2763 | 2726 |
|
2764 | 2727 | return dpnp_container.ones( |
2765 | 2728 | shape, |
@@ -2861,7 +2824,7 @@ def ones_like( |
2861 | 2824 |
|
2862 | 2825 | """ |
2863 | 2826 | dpnp.check_supported_arrays_type(a) |
2864 | | - _check_limitations(order=order, subok=subok) |
| 2827 | + dpnp.check_limitations(order=order, subok=subok) |
2865 | 2828 |
|
2866 | 2829 | _shape = a.shape if shape is None else shape |
2867 | 2830 | _dtype = a.dtype if dtype is None else dtype |
@@ -3347,7 +3310,7 @@ def zeros( |
3347 | 3310 |
|
3348 | 3311 | """ |
3349 | 3312 |
|
3350 | | - _check_limitations(order=order, like=like) |
| 3313 | + dpnp.check_limitations(order=order, like=like) |
3351 | 3314 |
|
3352 | 3315 | return dpnp_container.zeros( |
3353 | 3316 | shape, |
@@ -3450,7 +3413,7 @@ def zeros_like( |
3450 | 3413 | """ |
3451 | 3414 |
|
3452 | 3415 | dpnp.check_supported_arrays_type(a) |
3453 | | - _check_limitations(order=order, subok=subok) |
| 3416 | + dpnp.check_limitations(order=order, subok=subok) |
3454 | 3417 |
|
3455 | 3418 | _shape = a.shape if shape is None else shape |
3456 | 3419 | _dtype = a.dtype if dtype is None else dtype |
|
0 commit comments