示例#1
0
class PGDatabaseConnector(implements(DatabaseInterface)):
    def fetchIngredientsFromSearch(self, term, limit):
        results = PGDatabase().getIngredientsFromSearchTerm(term, limit)
        return results

    def createRecipe(self, recipe):
        if not recipe.name:
            raise MissingRecipeField("Missing name")
        if not recipe.servingSize:
            raise MissingRecipeField("Missing serving size")
        if not recipe.cuisine:
            raise MissingRecipeField("Missing cuisine")
        if not recipe.mealType:
            raise MissingRecipeField("Missing meal type")
        if not recipe.ingredients:
            raise MissingRecipeField("Missing ingredients")

        PGDatabase().insertRecipe(recipe.name, recipe.servingSize,
                                  recipe.cuisine, recipe.mealType,
                                  recipe.ingredients)
示例#2
0
class Cash(implements(Payment)):
    def execute(self):
        print("Cash On")
示例#3
0
class Bkash(implements(Payment)):
    def execute(self):
        print("Bkash")
示例#4
0
class Rocket(implements(Payment)):
    def execute(self):
        print("Rocket")
示例#5
0
class Circle(implements(Shape)):
    def draw() -> Shape:
        print('Circle is created')
示例#6
0
class AnotherShape(implements(Shape)):
    def draw() -> Shape:
        print('Another shape is created')
示例#7
0
class Triangle(implements(Shape)):
    def draw() -> Shape:
        print('Triangle is created')
示例#8
0
class Rectangle(implements(Shape)):
    def draw() -> Shape:
        print('Rectangle is created')