Skip to content

Commit

Permalink
feat(core/tree): have Tree.node() raise exception instead of returnin…
Browse files Browse the repository at this point in the history
…g None
  • Loading branch information
aravinda0 committed Apr 18, 2024
1 parent 06809f6 commit 6ba9734
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qtile_bonsai/core/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ def root(self) -> TabContainer | None:
def is_empty(self) -> bool:
return self.root is None

def node(self, id: int) -> Node | None:
def node(self, id: int) -> Node:
"""Return the node in the tree with the provided `id` or `None` if no such node
exists.
"""
for n in self.iter_walk():
if n.id == id:
return n
return None
raise ValueError(f"There is no node with the id: {id}")

def make_default_config(self) -> collections.defaultdict[int, dict[str, Any]]:
config = collections.defaultdict(dict)
Expand Down

0 comments on commit 6ba9734

Please sign in to comment.