|
6 | 6 | from dataclasses import dataclass
|
7 | 7 | from typing import Any
|
8 | 8 |
|
9 |
| -from arrayfire import backend, safe_call # TODO refactor |
10 |
| -from arrayfire.algorithm import count # TODO refactor |
11 |
| -from arrayfire.array import _get_indices, _in_display_dims_limit # TODO refactor |
| 9 | +# TODO replace imports from original lib with refactored ones |
| 10 | +from arrayfire import backend, safe_call |
| 11 | +from arrayfire.algorithm import count |
| 12 | +from arrayfire.array import _get_indices, _in_display_dims_limit |
12 | 13 |
|
13 | 14 | from .device import PointerSource
|
14 | 15 | from .dtypes import CShape, Dtype
|
@@ -630,35 +631,35 @@ def __iadd__(self, other: int | float | Array, /) -> Array:
|
630 | 631 | """
|
631 | 632 | return _process_c_function(self, other, backend.get().af_add)
|
632 | 633 |
|
633 |
| - def __isub__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 634 | + def __isub__(self, other: int | float | Array, /) -> Array: |
634 | 635 | """
|
635 | 636 | Return self -= other.
|
636 | 637 | """
|
637 | 638 | return _process_c_function(self, other, backend.get().af_sub)
|
638 | 639 |
|
639 |
| - def __imul__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 640 | + def __imul__(self, other: int | float | Array, /) -> Array: |
640 | 641 | """
|
641 | 642 | Return self *= other.
|
642 | 643 | """
|
643 | 644 | return _process_c_function(self, other, backend.get().af_mul)
|
644 | 645 |
|
645 |
| - def __itruediv__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 646 | + def __itruediv__(self, other: int | float | Array, /) -> Array: |
646 | 647 | """
|
647 | 648 | Return self /= other.
|
648 | 649 | """
|
649 | 650 | return _process_c_function(self, other, backend.get().af_div)
|
650 | 651 |
|
651 |
| - def __ifloordiv__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 652 | + def __ifloordiv__(self, other: int | float | Array, /) -> Array: |
652 | 653 | # TODO
|
653 | 654 | return NotImplemented
|
654 | 655 |
|
655 |
| - def __imod__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 656 | + def __imod__(self, other: int | float | Array, /) -> Array: |
656 | 657 | """
|
657 | 658 | Return self %= other.
|
658 | 659 | """
|
659 | 660 | return _process_c_function(self, other, backend.get().af_mod)
|
660 | 661 |
|
661 |
| - def __ipow__(self, other: int | float | bool | complex | Array, /) -> Array: |
| 662 | + def __ipow__(self, other: int | float | Array, /) -> Array: |
662 | 663 | """
|
663 | 664 | Return self **= other.
|
664 | 665 | """
|
@@ -1078,10 +1079,12 @@ def _constant_array(value: int | float | bool | complex, shape: CShape, dtype: D
|
1078 | 1079 | elif dtype == af_int64:
|
1079 | 1080 | # TODO discuss workaround for passing float to ctypes
|
1080 | 1081 | safe_call(backend.get().af_constant_long(
|
1081 |
| - ctypes.pointer(out.arr), ctypes.c_longlong(value.real), 4, ctypes.pointer(shape.c_array))) |
| 1082 | + ctypes.pointer(out.arr), ctypes.c_longlong(value.real), # type: ignore[arg-type] |
| 1083 | + 4, ctypes.pointer(shape.c_array))) |
1082 | 1084 | elif dtype == af_uint64:
|
1083 | 1085 | safe_call(backend.get().af_constant_ulong(
|
1084 |
| - ctypes.pointer(out.arr), ctypes.c_ulonglong(value.real), 4, ctypes.pointer(shape.c_array))) |
| 1086 | + ctypes.pointer(out.arr), ctypes.c_ulonglong(value.real), # type: ignore[arg-type] |
| 1087 | + 4, ctypes.pointer(shape.c_array))) |
1085 | 1088 | else:
|
1086 | 1089 | safe_call(backend.get().af_constant(
|
1087 | 1090 | ctypes.pointer(out.arr), ctypes.c_double(value), 4, ctypes.pointer(shape.c_array), dtype.c_api_value))
|
|
0 commit comments