import csv
from collections import OrderedDict
+from typing import Mapping, Sequence
from tabulate import tabulate
##############################################################################
# Day
##############################################################################
-def day_analyze(day_csv_paths: list, rda_csv_path: str = str()) -> tuple:
+def day_analyze(day_csv_paths: Sequence[str], rda_csv_path: str = str()) -> tuple:
"""Analyze a day optionally with custom RDAs,
e.g. nutra day ~/.nutra/rocky.csv -r ~/.nutra/dog-rdas-18lbs.csv
TODO: Should be a subset of foods_analyze
)
-# TODO: why not this...? nutrients: Mapping[int, tuple]
-def day_format(analysis: dict, nutrients: dict, buffer: int = 0) -> None:
+def day_format(
+ analysis: Mapping[int, float], nutrients: Mapping[int, list], buffer: int = 0
+) -> None:
"""Formats day analysis for printing to console"""
def print_header(header: str) -> None:
print("=" * (len(header) + 2 * 5))
print(CLI_CONFIG.style_reset_all)
- def print_nute_bar(_n_id: int, amount: float, _nutrients: dict) -> tuple:
+ def print_nute_bar(
+ _n_id: int, amount: float, _nutrients: Mapping[int, list]
+ ) -> tuple:
nutrient = _nutrients[_n_id]
rda = nutrient[1]
tag = nutrient[3]