Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Avoid entering into the more complex else branch
Browse files Browse the repository at this point in the history
  • Loading branch information
etienneschalk committed Jan 6, 2024
1 parent 057a638 commit 6d1d787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datatree/treenode.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def relative_to(self: NamedNode, other: NamedNode) -> str:
)

this_path = NodePath(self.path)
if other.path in list(parent.path for parent in self.parents):
if other.path in list(parent.path for parent in (self, *self.parents)):
return str(this_path.relative_to(other.path))
else:
common_ancestor = self.find_common_ancestor(other)
Expand Down

0 comments on commit 6d1d787

Please sign in to comment.