From a69e9dd01ec5aafc8c7eb9fbc66d3b9332765ede Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 5 Aug 2024 11:11:59 -0500
Subject: [PATCH] Drop deprecated actx.{empty,zeros}{,_like}

---
 arraycontext/context.py                | 20 ---------------
 arraycontext/impl/jax/__init__.py      | 32 -----------------------
 arraycontext/impl/pyopencl/__init__.py | 35 --------------------------
 arraycontext/impl/pytato/__init__.py   | 32 -----------------------
 4 files changed, 119 deletions(-)

diff --git a/arraycontext/context.py b/arraycontext/context.py
index 8b42bca..0640e5a 100644
--- a/arraycontext/context.py
+++ b/arraycontext/context.py
@@ -297,12 +297,6 @@ class ArrayContext(ABC):
     def __hash__(self) -> int:
         raise TypeError(f"unhashable type: '{type(self).__name__}'")
 
-    @abstractmethod
-    def empty(self,
-              shape: Union[int, Tuple[int, ...]],
-              dtype: "np.dtype[Any]") -> Array:
-        pass
-
     def zeros(self,
               shape: Union[int, Tuple[int, ...]],
               dtype: "np.dtype[Any]") -> Array:
@@ -312,20 +306,6 @@ class ArrayContext(ABC):
 
         return self.np.zeros(shape, dtype)
 
-    def empty_like(self, ary: Array) -> Array:
-        warn(f"{type(self).__name__}.empty_like is deprecated and will stop "
-            "working in 2023. Prefer actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.empty(shape=ary.shape, dtype=ary.dtype)
-
-    def zeros_like(self, ary: Array) -> Array:
-        warn(f"{type(self).__name__}.zeros_like is deprecated and will stop "
-            "working in 2023. Use actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.zeros(shape=ary.shape, dtype=ary.dtype)
-
     @abstractmethod
     def from_numpy(self,
                    array: NumpyOrContainerOrScalar
diff --git a/arraycontext/impl/jax/__init__.py b/arraycontext/impl/jax/__init__.py
index 0304541..26cb9db 100644
--- a/arraycontext/impl/jax/__init__.py
+++ b/arraycontext/impl/jax/__init__.py
@@ -87,38 +87,6 @@ class EagerJAXArrayContext(ArrayContext):
 
     # {{{ ArrayContext interface
 
-    def empty(self, shape, dtype):
-        from warnings import warn
-        warn(f"{type(self).__name__}.empty is deprecated and will stop "
-            "working in 2023. Prefer actx.np.zeros instead.",
-            DeprecationWarning, stacklevel=2)
-
-        import jax.numpy as jnp
-        return jnp.empty(shape=shape, dtype=dtype)
-
-    def zeros(self, shape, dtype):
-        import jax.numpy as jnp
-        return jnp.zeros(shape=shape, dtype=dtype)
-
-    def empty_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.empty_like is deprecated and will stop "
-            "working in 2023. Prefer actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        def _empty_like(array):
-            return self.empty(array.shape, array.dtype)
-
-        return self._rec_map_container(_empty_like, ary)
-
-    def zeros_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.zeros_like is deprecated and will stop "
-            "working in 2023. Use actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.np.zeros_like(ary)
-
     def from_numpy(self, array):
         def _from_numpy(ary):
             import jax
diff --git a/arraycontext/impl/pyopencl/__init__.py b/arraycontext/impl/pyopencl/__init__.py
index 9be77a4..de188cb 100644
--- a/arraycontext/impl/pyopencl/__init__.py
+++ b/arraycontext/impl/pyopencl/__init__.py
@@ -198,41 +198,6 @@ class PyOpenCLArrayContext(ArrayContext):
 
     # {{{ ArrayContext interface
 
-    def empty(self, shape, dtype):
-        from warnings import warn
-        warn(f"{type(self).__name__}.empty is deprecated and will stop "
-            "working in 2023. Prefer actx.np.zeros instead.",
-            DeprecationWarning, stacklevel=2)
-
-        import arraycontext.impl.pyopencl.taggable_cl_array as tga
-        return tga.empty(self.queue, shape, dtype, allocator=self.allocator)
-
-    def zeros(self, shape, dtype):
-        import arraycontext.impl.pyopencl.taggable_cl_array as tga
-        return tga.zeros(self.queue, shape, dtype, allocator=self.allocator)
-
-    def empty_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.empty_like is deprecated and will stop "
-            "working in 2023. Prefer actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        import arraycontext.impl.pyopencl.taggable_cl_array as tga
-
-        def _empty_like(array):
-            return tga.empty(self.queue, array.shape, array.dtype,
-                allocator=self.allocator, axes=array.axes, tags=array.tags)
-
-        return self._rec_map_container(_empty_like, ary)
-
-    def zeros_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.zeros_like is deprecated and will stop "
-            "working in 2023. Use actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.np.zeros_like(ary)
-
     def from_numpy(self, array):
         import arraycontext.impl.pyopencl.taggable_cl_array as tga
 
diff --git a/arraycontext/impl/pytato/__init__.py b/arraycontext/impl/pytato/__init__.py
index 8737e5f..5ece78e 100644
--- a/arraycontext/impl/pytato/__init__.py
+++ b/arraycontext/impl/pytato/__init__.py
@@ -171,22 +171,6 @@ class _BasePytatoArrayContext(ArrayContext, abc.ABC):
         Returns valid frozen array types for the array context.
         """
 
-    # {{{ ArrayContext interface
-
-    def empty(self, shape, dtype):
-        raise NotImplementedError(
-            f"{type(self).__name__}.empty is not supported")
-
-    def zeros(self, shape, dtype):
-        import pytato as pt
-        return pt.zeros(shape, dtype)
-
-    def empty_like(self, ary):
-        raise NotImplementedError(
-            f"{type(self).__name__}.empty_like is not supported")
-
-    # }}}
-
     # {{{ compilation
 
     def transform_dag(self, dag: pytato.DictOfNamedArrays
@@ -380,14 +364,6 @@ class PytatoPyOpenCLArrayContext(_BasePytatoArrayContext):
 
     # {{{ ArrayContext interface
 
-    def zeros_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.zeros_like is deprecated and will stop "
-            "working in 2023. Use actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.np.zeros_like(ary)
-
     def from_numpy(self, array):
         import pytato as pt
 
@@ -776,14 +752,6 @@ class PytatoJAXArrayContext(_BasePytatoArrayContext):
 
     # {{{ ArrayContext interface
 
-    def zeros_like(self, ary):
-        from warnings import warn
-        warn(f"{type(self).__name__}.zeros_like is deprecated and will stop "
-            "working in 2023. Use actx.np.zeros_like instead.",
-            DeprecationWarning, stacklevel=2)
-
-        return self.np.zeros_like(ary)
-
     def from_numpy(self, array):
         import jax
         import pytato as pt
-- 
GitLab