Skip to content

Adding support for subtree sort control #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions treelib/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def size(self, level=None):
raise TypeError(
"level should be an integer instead of '%s'" % type(level))

def subtree(self, nid, identifier=None):
def subtree(self, nid, identifier=None, *args, **kwargs):
"""
Return a shallow COPY of subtree with nid being the new root.
If nid is None, return an empty tree.
Expand All @@ -884,7 +884,7 @@ def subtree(self, nid, identifier=None):
raise NodeIDAbsentError("Node '%s' is not in the tree" % nid)

st.root = nid
for node_n in self.expand_tree(nid):
for node_n in self.expand_tree(nid, *args, **kwargs):
st._nodes.update({self[node_n].identifier: self[node_n]})
# define nodes parent/children in this tree
# all pointers are the same as copied tree, except the root
Expand Down