allow using a single string as an ingredient instead of a dict

This commit is contained in:
Emi Vasilek 2023-11-28 12:28:52 +00:00
parent 072aa03a53
commit 883f0756f9
5 changed files with 59 additions and 17 deletions

View file

@ -139,7 +139,8 @@ class Builder:
def collect_unitnames(rec: parsing.Recipe) -> List[str]:
results: List[str] = []
for ing in rec.ingredients:
results.append(ing.unit.name)
if ing.unit is not None:
results.append(ing.unit.name)
return results
unitnamelists = self.foreach_recipe(collect_unitnames)