Skip to content

Commit

Permalink
depr(expr-api): deprecate useless has_name method (#9901)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Aug 22, 2024
1 parent 2f2c3ed commit e0436aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion ibis/expr/types/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e0436aa

Please sign in to comment.