INNER CODE UNIT · Python
fng_statistics_term_content
rfc-st/humble · humble.py:409
def fng_statistics_term_content(fng_groups, fng_term, term_cnt, fng_incl):
"""Compute percentage of fingerprint headers matching the search term.
Related to `-f` option.
"""
fng_pct = round(term_cnt / len(fng_incl) * 100, 2)
print(f"{get_detail('[fng_add]', replace=True)} '{fng_term}': {fng_pct}%\
({term_cnt}{get_detail('[pdf_footer2]', replace=True)} {len(fng_incl)})")
fng_statistics_term_sorted(fng_incl, fng_term.lower(), fng_groups)
def fng_statistics_term_sorted(fng_incl, fng_term, fng_groups):
"""Print the service associated with the term provided.
In alphabetical order and terminate execution; related to `-f` option.
"""
for content in fng_groups:
print(f"\n [{STYLE[0]}{content}]")