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

Commit 2c0b3ea

Browse files
committed
Avoid entering into the more complex else branch
1 parent cc50b71 commit 2c0b3ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

datatree/treenode.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def relative_to(self: NamedNode, other: NamedNode) -> str:
634634
)
635635

636636
this_path = NodePath(self.path)
637-
if other.path in list(parent.path for parent in self.parents):
637+
if other.path in list(parent.path for parent in (self, *self.parents)):
638638
return str(this_path.relative_to(other.path))
639639
else:
640640
common_ancestor = self.find_common_ancestor(other)

0 commit comments

Comments
 (0)