Skip to content

Commit

Permalink
Remove unused functions. (#598)
Browse files Browse the repository at this point in the history
* Remove unused _get_branches function.

* Remove unused _flatten function.

* Define error message in one line.
  • Loading branch information
bdice authored Aug 6, 2021
1 parent 2eda6b9 commit 579800d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 51 deletions.
26 changes: 4 additions & 22 deletions signac/contrib/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,6 @@
MAX_DEFAULT_ID = int("F" * 32, 16)


def _flatten(container):
"""Yield elements from the container.
Parameters
----------
container : sequence
List or tuple of elements.
Yields
------
Elements of container, recursively flattening sub-sequences.
"""
for i in container:
if isinstance(i, (list, tuple)):
yield from _flatten(i)
else:
yield i


class _DictPlaceholder:
pass

Expand Down Expand Up @@ -304,8 +284,10 @@ def op(value, argument):
elif len(argument) == 3:
argument, rel_tol, abs_tol = argument
else:
err_msg = "The argument of the $near operator must be a float "
err_msg += "or a list of floats with length 1, 2, or 3."
err_msg = (
"The argument of the $near operator must be a float or a list of floats with "
"length 1, 2, or 3."
)
raise ValueError(err_msg)
argument = float(argument)
rel_tol = float(rel_tol)
Expand Down
29 changes: 0 additions & 29 deletions signac/contrib/linked_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,35 +297,6 @@ def _build_tree(paths):
return root


def _get_branches(root, branch=None):
"""Get all branches from the root node.
Parameters
----------
root : :class:`~signac.contrib.linked_view._Node`
Root node.
branch : list
The current list of branches that has been collected,
used in recursive calls to build up the branches starting
at the root (Default value = None).
Yields
------
list
Branches for the root node.
"""
if branch is None:
branch = []
else:
branch = list(branch) + [root]
if root.children:
for child in root.children.values():
yield from _get_branches(child, branch)
else:
yield branch


def _color_path(root, path):
"""Color the path from root by setting value to True.
Expand Down

0 comments on commit 579800d

Please sign in to comment.