Skip to content

Commit

Permalink
add __contains__ method
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Jan 13, 2023
1 parent 4d60944 commit 76cb176
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions loopy/schedule/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def is_leaf(self, node: NodeT) -> bool:
def is_a_node(self, node: NodeT) -> bool:
return node in self._child_to_parent

def __contains__(self, node: NodeT) -> bool:
return self.is_a_node(node)

def add_node(self, node: NodeT, parent: NodeT) -> "Tree[NodeT]":
"""
Returns a :class:`Tree` with added node *node* having a parent
Expand Down

0 comments on commit 76cb176

Please sign in to comment.