use get instead of setdefault for kwargs.
This commit is contained in:
parent
936f54761b
commit
8d51c95e68
1 changed files with 4 additions and 4 deletions
|
@ -397,10 +397,10 @@ def preorder_traversal(self, visited=None, d=0, **kwargs):
|
|||
root [=True]
|
||||
If false, this won't yield the root node, just its descendents.
|
||||
"""
|
||||
depth = kwargs.setdefault('depth', False)
|
||||
key_fun = kwargs.setdefault('key', id)
|
||||
yield_root = kwargs.setdefault('root', True)
|
||||
cover = kwargs.setdefault('cover', 'nodes')
|
||||
depth = kwargs.get('depth', False)
|
||||
key_fun = kwargs.get('key', id)
|
||||
yield_root = kwargs.get('root', True)
|
||||
cover = kwargs.get('cover', 'nodes')
|
||||
|
||||
cover_values = ('nodes', 'edges', 'paths')
|
||||
if cover not in cover_values:
|
||||
|
|
Loading…
Reference in a new issue