refactored common logic for printing ignored entries

This commit is contained in:
2020-11-03 18:17:48 +01:00
parent 8a4aa7f5bf
commit be0e5005d5
2 changed files with 12 additions and 14 deletions

View File

@ -1,4 +1,5 @@
from .consts import SYM_NOTHING, SYM_GOOD, SYM_BAD
from .df import count_true
from .seq import is_empty
@ -22,6 +23,14 @@ def print_bad(*args, **kwargs):
return print(SYM_BAD, *args, **kwargs)
def print_ignored(df, which, reason): #TODO: should df be the argument or df.index?
all_names = df.index
ignored = all_names[~which]
if not is_empty(ignored):
print(f"ignored due to {reason}:")
print(itemize(ignored))
print()
def itemize(iterable, bullet=""):
if not bullet.endswith(" "):
bullet += " "