Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit bfa26ef0 authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

- Default argument for 'include_root' in Node.select and .select_by_tag now False

parent d7a1433e
......@@ -595,7 +595,7 @@ class Node(collections.abc.Sized):
return self._tree_repr(' ' * indentation, opening, closing, density=1)
def select(self, match_function: Callable, include_root: bool=True) -> Iterator['Node']:
def select(self, match_function: Callable, include_root: bool=False) -> Iterator['Node']:
"""
Finds nodes in the tree that fulfill a given criterion.
......@@ -623,7 +623,7 @@ class Node(collections.abc.Sized):
def select_by_tag(self, tag_names: Union[str, AbstractSet[str]],
include_root: bool=True) -> Iterator['Node']:
include_root: bool=False) -> Iterator['Node']:
"""
Returns an iterator that runs through all descendants that have one
of the given tag names.
......
......@@ -209,7 +209,7 @@ class TestNodeFind():
assert matches[1] == parse_sxpr('(X F)')
# check default: root is included in search:
matchf2 = lambda node: match_tag_name(node, 'a')
assert list(tree.select(matchf2))
assert list(tree.select(matchf2, include_root=True))
assert not list(tree.select(matchf2, include_root=False))
def test_getitem(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment