diff --git a/python/taichi/_snode/fields_builder.py b/python/taichi/_snode/fields_builder.py index 6525aec1178ae6..da576aa8d4b9a2 100644 --- a/python/taichi/_snode/fields_builder.py +++ b/python/taichi/_snode/fields_builder.py @@ -76,8 +76,7 @@ def pointer(self, indices: Union[Sequence[_Axis], _Axis], """Same as :func:`taichi.lang.snode.SNode.pointer`""" if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Pointer SNode on metal backend is deprecated and removed." - ) + "Pointer SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.pointer(indices, dimensions) @@ -93,8 +92,7 @@ def dynamic(self, """Same as :func:`taichi.lang.snode.SNode.dynamic`""" if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Dynamic SNode on metal backend is deprecated and removed." - ) + "Dynamic SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.dynamic(index, dimension, chunk_size) @@ -104,8 +102,7 @@ def bitmasked(self, indices: Union[Sequence[_Axis], _Axis], """Same as :func:`taichi.lang.snode.SNode.bitmasked`""" if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Bitmasked SNode on metal backend is deprecated and removed." - ) + "Bitmasked SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.bitmasked(indices, dimensions) diff --git a/python/taichi/lang/snode.py b/python/taichi/lang/snode.py index 8885a4fd2ec776..15fab24924d80b 100644 --- a/python/taichi/lang/snode.py +++ b/python/taichi/lang/snode.py @@ -2,9 +2,9 @@ from taichi._lib import core as _ti_core from taichi.lang import expr, impl, matrix +from taichi.lang.exception import TaichiRuntimeError from taichi.lang.field import BitpackedFields, Field from taichi.lang.util import get_traceback -from taichi.lang.exception import TaichiRuntimeError class SNode: @@ -50,8 +50,7 @@ def pointer(self, axes, dimensions): """ if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Pointer SNode on metal backend is deprecated and removed." - ) + "Pointer SNode on metal backend is deprecated and removed.") if isinstance(dimensions, numbers.Number): dimensions = [dimensions] * len(axes) return SNode( @@ -81,8 +80,7 @@ def dynamic(self, axis, dimension, chunk_size=None): """ if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Dynamic SNode on metal backend is deprecated and removed." - ) + "Dynamic SNode on metal backend is deprecated and removed.") assert len(axis) == 1 if chunk_size is None: chunk_size = dimension @@ -102,8 +100,7 @@ def bitmasked(self, axes, dimensions): """ if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Bitmasked SNode on metal backend is deprecated and removed." - ) + "Bitmasked SNode on metal backend is deprecated and removed.") if isinstance(dimensions, numbers.Number): dimensions = [dimensions] * len(axes) return SNode( diff --git a/tests/python/test_deprecation.py b/tests/python/test_deprecation.py index c4f131de55518d..20d5b43b2d8e25 100644 --- a/tests/python/test_deprecation.py +++ b/tests/python/test_deprecation.py @@ -73,27 +73,23 @@ def test_deprecate_element_shape_ndarray_arg(): ndim=1, element_shape=(1, )) + # Remove this before v1.5.0 @test_utils.test(arch=ti.metal) def test_deprecate_metal_sparse(): with pytest.raises( ti.TaichiRuntimeError, - match= - "Pointer SNode on metal backend is deprecated and removed." - ): + match="Pointer SNode on metal backend is deprecated and removed."): a = ti.root.pointer(ti.i, 10) with pytest.raises( ti.TaichiRuntimeError, - match= - "Bitmasked SNode on metal backend is deprecated and removed." + match="Bitmasked SNode on metal backend is deprecated and removed." ): b = a.bitmasked(ti.j, 10) with pytest.raises( ti.TaichiRuntimeError, - match= - "Dynamic SNode on metal backend is deprecated and removed." - ): + match="Dynamic SNode on metal backend is deprecated and removed."): ti.root.dynamic(ti.i, 10)