🎨 black-ify the code base
This commit is contained in:
parent
83e1caf19d
commit
d54fd73e53
9 changed files with 126 additions and 19 deletions
|
|
@ -17,7 +17,7 @@ def grams(ingredient):
|
|||
if c["unit"] in ["g / Gramm", "g"]:
|
||||
conversion = c
|
||||
if conversion:
|
||||
return conversion.get('amount')
|
||||
return conversion.get("amount")
|
||||
|
||||
|
||||
def allergens_for_step_ingredients(step):
|
||||
|
|
@ -50,6 +50,7 @@ def allergens_for_recipe(recipe):
|
|||
def link(recipe):
|
||||
return f"{TANDOOR_URL + "/view/recipe/" + str(recipe["id"])}"
|
||||
|
||||
|
||||
def wiki_link(recipe):
|
||||
wiki_slug = recipe["name"]
|
||||
wiki_slug = re.sub(" ", "_", wiki_slug)
|
||||
|
|
@ -84,10 +85,20 @@ def main():
|
|||
recipes.sort(key=lambda r: r["name"])
|
||||
|
||||
# filter "Frühstück"
|
||||
recipes = [r for r in recipes if any(k["name"] == "Fr\u00fchst\u00fcck" for k in r["keywords"])]
|
||||
recipes = [
|
||||
r
|
||||
for r in recipes
|
||||
if any(k["name"] == "Fr\u00fchst\u00fcck" for k in r["keywords"])
|
||||
]
|
||||
|
||||
with open("fruehstueck.csv", "w", newline="") as f:
|
||||
fwriter = csv.writer(f, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL, lineterminator="\n")
|
||||
fwriter = csv.writer(
|
||||
f,
|
||||
delimiter=";",
|
||||
quotechar='"',
|
||||
quoting=csv.QUOTE_MINIMAL,
|
||||
lineterminator="\n",
|
||||
)
|
||||
fwriter.writerow(["title", "url", "isVegan", "ingredients", "comment"])
|
||||
|
||||
for recipe in recipes:
|
||||
|
|
@ -98,7 +109,9 @@ def main():
|
|||
|
||||
zn = decruft_ingredient(i_name)
|
||||
if i_allergens != "(keine)":
|
||||
i_allergens = i_allergens.replace("⁉\ufe0f", "\\faExclamationTriangle")
|
||||
i_allergens = i_allergens.replace(
|
||||
"⁉\ufe0f", "\\faExclamationTriangle"
|
||||
)
|
||||
zn += f" (\\Alg{{{i_allergens}}})"
|
||||
|
||||
zutaten.append((i_grams, zn))
|
||||
|
|
@ -106,13 +119,15 @@ def main():
|
|||
zutaten = aggregate_zutaten(zutaten)
|
||||
zutaten.sort(key=lambda z: z[0], reverse=True)
|
||||
|
||||
fwriter.writerow([
|
||||
recipe["name"],
|
||||
wiki_link(recipe),
|
||||
1, # XXX hardcoded
|
||||
", ".join(z[1] for z in zutaten),
|
||||
""
|
||||
])
|
||||
fwriter.writerow(
|
||||
[
|
||||
recipe["name"],
|
||||
wiki_link(recipe),
|
||||
1, # XXX hardcoded
|
||||
", ".join(z[1] for z in zutaten),
|
||||
"",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue