def __init__(self): #reads the information from the CSV file with open('src/dataset/recipes.CSV', newline='') as f: file = csv.reader(f) for line in file: #create new recipe new_recipe = Recipe(line[0], int(line[1]), int(line[2]), int(line[3]), int(line[4])) #add its ingredients for ing in range(5, len(line)): #the following is a little clean up because of the way the CSV file is written if len(line[ing]) > 2: if ing != 5: line[ing] = line[ing][1:] new_recipe.addIngredient(line[ing]) self.recipes.append( new_recipe) # add recipe to list of recipes
from Recipe import Recipe import numpy as np #Make a test recipe: tester=Recipe() tester.setCategory("Cider") tester.setName("BrewDevil") tester.setFlavor("Standard Cider, no additional fruit") tester.setYeast("Brew Devil Brand") tester.setGoalABV(0) tester.setOG(0) tester.setFG(0) tester.addIngredient("1.5C Granulated White Sugar") tester.addIngredient("1 Can Brew Devil Cider Concentrate") tester.addIngredient("2 Gallons Water- Chippewa Valley Spring Water") tester.setTasteNotes("Pre-Yeast: Not particularly strong flavor, watery and sweet. low acidiy") tester.setStartDate("2020-10-08") tester.printRecipe() tester.writeRecipe()