示例#1
0
def make_burger(order, kitchen):
    recipe = RECIPES[order]
    ingredients_list = ingredients_list_from_recipe(recipe)
    ingredients = gather_ingredients(ingredients_list, kitchen.pantry)
    prepared_ingredients = [prepare_ingerdient(ingredient, kitchen) for ingredient in ingredients]
    prepared_ingredients = list(flat_generator(prepared_ingredients))
    return Burger(order, select_ingredients(recipe, prepared_ingredients))
def make_burger(order, kitchen):
    recipe = RECIPES[order]
    ingredients_list = ingredients_list_from_recipe(recipe)
    ingredients = gather_ingredients(ingredients_list, kitchen.pantry)

    grillable_ingredients = [
        ingredient for ingredient in ingredients if isinstance(ingredient, GrillableIngredient)
    ]
    sliceable_ingredients = [
        ingredient for ingredient in ingredients if isinstance(ingredient, SliceableIngredient)
    ]

    prepared_ingredients = prepare_parallel(sliceable_ingredients, kitchen.cutting_boards, slice_ingredient)
    prepared_ingredients += prepare_parallel(grillable_ingredients, kitchen.grills, grill_ingredient)
    prepared_ingredients = list(flat_generator(prepared_ingredients))
    return Burger(order, select_ingredients(recipe, prepared_ingredients))