From 2df8f637335d05c3d7fb0e6d543edb9bed405e60 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:38:49 -0400 Subject: [PATCH] depr(expr-api): remove useless `has_name` method --- ibis/expr/types/core.py | 7 ++++++- ibis/expr/types/generic.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ibis/expr/types/core.py b/ibis/expr/types/core.py index 33a70f570818..ea47f7059fd3 100644 --- a/ibis/expr/types/core.py +++ b/ibis/expr/types/core.py @@ -17,7 +17,7 @@ from ibis.config import _default_backend from ibis.config import options as opts from ibis.expr.format import pretty -from ibis.util import experimental +from ibis.util import deprecated, experimental if TYPE_CHECKING: from collections.abc import Iterator, Mapping @@ -182,6 +182,11 @@ def __bool__(self) -> bool: __nonzero__ = __bool__ + @deprecated( + instead="remove any usage of `has_name`, since it is always `True`", + as_of="9.4", + removed_in="10.0", + ) def has_name(self): """Check whether this expression has an explicit name.""" return hasattr(self._arg, "name") diff --git a/ibis/expr/types/generic.py b/ibis/expr/types/generic.py index 7a2cfcce3aa5..f607ae9385d3 100644 --- a/ibis/expr/types/generic.py +++ b/ibis/expr/types/generic.py @@ -71,7 +71,7 @@ def name(self, name): # TODO(kszucs): shouldn't do simplification here, but rather later # when simplifying the whole operation tree # the expression's name is idendical to the new one - if self.has_name() and self.get_name() == name: + if self.get_name() == name: return self if isinstance(self.op(), ops.Alias):