remove useless functions

This commit is contained in:
chen 2016-10-17 16:23:21 -04:00
parent fb1e4f0c39
commit 1a2194f042
1 changed files with 0 additions and 29 deletions

View File

@ -16,35 +16,6 @@ scriptID = ' '.join([scriptName, damask.version])
# element at a time, maybe there are some other ways to make this
# faster.
# ----- Helper functions ----- #
# ref: http://stackoverflow.com/questions/16801322/how-can-i-check-that-a-list-
# has-one-and-only-one-truthy-value
# NOTE:
# These functions might be useful in the future
def n_trues(iterable, n=1):
"""N(trues) = n"""
i = iter(iterable)
return all(any(i) for j in range(n)) and not any(i)
def up_to_n_trues(iterable, n=1):
i = iter(iterable)
all(any(i) for j in range(n))
return not any(i)
def at_least_n_trues(iterable, n=1):
i = iter(iterable)
return all(any(i) for j in range(n))
def m_to_n_trues(iterable, m=1, n=1):
i = iter(iterable)
assert m <= n
return at_least_n_trues(i, m) and up_to_n_trues(i, n - m)
# --------------------------------------------------------------------
# MAIN
# --------------------------------------------------------------------