Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User:
- def __init__(self, username, email, profile):
- self.username = username
- self.email = email
- self.profile = profile
- self.coins = 0
- class Profile:
- def __init__(self, bio, pictures):
- self.bio = bio
- self.pictures = pictures
- class Image:
- def __init__(self, path, blurred=True):
- self.path = path
- self.blur = blurred
- def unblur():
- pass #TODO
- class Message:
- def __init__(self, contents, author):
- self.author = author
- self.contents = contents
- def unblur(self):
- assert type(self.contents) is Image, "Can't unblur a string"
- self.contents.unblur()
- class Chat:
- def __init__(self, seller, buyer):
- self.seller = seller
- self.buyer = buyer
- self.messages = list()
- def send_message(self, message):
- messages.append(message)
- pass #TODO
- class Seller(User):
- def __init__(self):
- self.name = name
- self.matches = list()
- self.available_buyers = list()
- def add_match(self, buyer):
- assert buyer in available_buyers
- matches.append(buyer)
- buyer.add_match(self)
- def add_buyer(self, buyer):
- available_buyers.append(buyer)
- class Buyer(User):
- def __init__(self):
- self.swipes = list()
- self.matches = list()
- def add_swipe(self, seller):
- swipes.append(seller)
- seller.add_buyer(self)
- def add_match(self, seller):
- assert seller in swipes
- matches.append(seller)
- def send_coins(self, num_coins, seller):
- assert seller in matches
- assert num_coins <= self.coins
- self.coins -= num_coins
- seller.coins += num_coins
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement