Skip to content

Commit

Permalink
changes behaviour of get_cached_content(leaves_only=False), so conten…
Browse files Browse the repository at this point in the history
…t does not include node itself unless tip
  • Loading branch information
jhcepas committed Aug 7, 2017
1 parent 6f60503 commit f6d041f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions ete3/coretype/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,22 +1593,19 @@ def get_value(_n):
_store=_store)

if self.children:
if leaves_only:
val = container_type()
else:
val = container_type(get_value(self))

val = container_type()
for ch in self.children:
if type(val) == list:
val.extend(_store[ch])
if type(val) == set:
val.update(_store[ch])

if not leaves_only:
if type(val) == list:
val.append(self)
if type(val) == set:
val.update(self)
if not leaves_only:
if type(val) == list:
val.extend(get_value(ch))
if type(val) == set:
val.update(get_value(ch))

_store[self] = val
else:
_store[self] = container_type(get_value(self))
Expand Down

0 comments on commit f6d041f

Please sign in to comment.