Skip to content

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
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.