예제 #1
0
supply = list()
orders = list()
items = list()
reviews = list()

admin1 = Administrator("iamgod", "iamthelaw", "*****@*****.**")
supplier1 = Supplier("isupply", "4real", "Crab Shack Company", "Van Crabs",
                     "000-112-35-8", "*****@*****.**")
supplier2 = Supplier("isupplytoo", "4real", "Reliable Company", "Van Reliable",
                     "011-112-35-8", "*****@*****.**")
customer1 = Customer("iamguido", "4sure", "Guido", "Van Rossum",
                     "000-112-35-8", "*****@*****.**", "09-09-1968")
item1 = Item("Banana", "Better than ever before", 799.0,
             ("Golden", "Fresh Green"))
item2 = Item("Best Banana", "Better than others", 899.0,
             ("Truly Golden", "Fresher Green"))

review1 = Review('Brilliant', "iamguido", 5)

supply.append(supplier1.add_supply(item1, 10))
supply.append(supplier2.add_supply(item2, 3))

customer1.create_order(item2, 5)
print(customer1.orders[0].status)

admin1.update_supply([supplier1, supplier2])
admin1.update_orders([customer1])

admin1.check_order(customer1.orders[0])
print(customer1.orders[0].status)
예제 #2
0
import uuid
from simple_logger import logger


class Supply:
    def __init__(self, item, supplier, amount):
        self.id = uuid.uuid4()
        self.item = item
        self.supplier = supplier
        self.amount = amount
        self.log = logger
        self.log.info(f"Supply is done")

    def __str__(self):
        return f"{self.id}: {self.item} by {self.supplier}"

    def __repr__(self):
        return f"{self.id}: {self.amount} {self.item.title} by {self.supplier.company_name}"


if __name__ == '__main__':
    from supplier import Supplier
    from item import Item
    supplier1 = Supplier("isupply", "4real", "Crab Shack Company", "Van Crabs",
                         "000-112-35-8", "*****@*****.**")
    item1 = Item("Banana", "Better than ever before", 799.0,
                 ("Golden", "Fresh Green"))
    supplier1.add_supply(item1, 10)