Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. class User:
  2. def __init__(self, username, email, profile):
  3. self.username = username
  4. self.email = email
  5. self.profile = profile
  6. self.coins = 0
  7.  
  8. class Profile:
  9. def __init__(self, bio, pictures):
  10. self.bio = bio
  11. self.pictures = pictures
  12.  
  13.  
  14. class Image:
  15. def __init__(self, path, blurred=True):
  16. self.path = path
  17. self.blur = blurred
  18.  
  19. def unblur():
  20. pass #TODO
  21.  
  22.  
  23. class Message:
  24. def __init__(self, contents, author):
  25. self.author = author
  26. self.contents = contents
  27.  
  28. def unblur(self):
  29. assert type(self.contents) is Image, "Can't unblur a string"
  30. self.contents.unblur()
  31.  
  32.  
  33. class Chat:
  34. def __init__(self, seller, buyer):
  35. self.seller = seller
  36. self.buyer = buyer
  37. self.messages = list()
  38.  
  39. def send_message(self, message):
  40. messages.append(message)
  41. pass #TODO
  42.  
  43.  
  44. class Seller(User):
  45. def __init__(self):
  46. self.name = name
  47. self.matches = list()
  48. self.available_buyers = list()
  49.  
  50. def add_match(self, buyer):
  51. assert buyer in available_buyers
  52. matches.append(buyer)
  53. buyer.add_match(self)
  54.  
  55. def add_buyer(self, buyer):
  56. available_buyers.append(buyer)
  57.  
  58.  
  59. class Buyer(User):
  60. def __init__(self):
  61. self.swipes = list()
  62. self.matches = list()
  63.  
  64. def add_swipe(self, seller):
  65. swipes.append(seller)
  66. seller.add_buyer(self)
  67.  
  68. def add_match(self, seller):
  69. assert seller in swipes
  70. matches.append(seller)
  71.  
  72. def send_coins(self, num_coins, seller):
  73. assert seller in matches
  74. assert num_coins <= self.coins
  75.  
  76. self.coins -= num_coins
  77. seller.coins += num_coins
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement