Skip to content

Commit

Permalink
print_header() method in food analysis printout
Browse files Browse the repository at this point in the history
  • Loading branch information
gamesguru committed Jul 21, 2023
1 parent 65256a8 commit 54cdf41
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ntclient/services/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ def foods_analyze(food_ids: set, grams: float = 0) -> tuple:
TODO: support -t (tabular/non-visual) output flag
"""

def print_header(header: str) -> None:
"""Print a header for this method"""
print()
print("=========================")
print(header)
print()
print("=========================")

################################################################################
# Get analysis
################################################################################
Expand Down Expand Up @@ -71,7 +79,7 @@ def foods_analyze(food_ids: set, grams: float = 0) -> tuple:
+ "==> {0} ({1})\n".format(food_name, food_id)
+ "======================================\n"
)
print("\n=========================\nSERVINGS\n=========================\n")
print_header("SERVINGS")

################################################################################
# Serving table
Expand All @@ -87,11 +95,11 @@ def foods_analyze(food_ids: set, grams: float = 0) -> tuple:
((x[7], x[8]) for x in food_des.values() if x[0] == food_id and x[7]), None
)
if refuse:
print("\n=========================\nREFUSE\n=========================\n")
print_header("REFUSE")
print(refuse[0])
print(" ({0}%, by mass)".format(refuse[1]))

print("\n=========================\nNUTRITION\n=========================\n")
print_header("NUTRITION")

################################################################################
# Nutrient table
Expand Down

0 comments on commit 54cdf41

Please sign in to comment.