-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_objects.py
71 lines (48 loc) · 1.17 KB
/
data_objects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
__author__ = 'vmladenov'
class Category:
def __init__(self):
self.id = -1
self.name = ""
self.url = ""
self.sub_categories = []
def __str__(self):
return self.name
class Recipe:
def __init__(self):
self.id = -1
self.title = ""
self.site_id = -1
self.products = ""
self.description = ""
self.image_url = ""
self.thumbnail_url = ""
self.prepare_time = ""
self.cook_time = ""
self.portions = ""
def __str__(self):
return self.title
class Useful:
def __init__(self):
self.id = -1
self.title = ""
self.description = ""
self.image_url = ""
self.thumbnail_url = ""
def __str__(self):
return self.title
class Advice(Useful):
pass
class Spice(Useful):
pass
class Product(Useful):
pass
class UsefulType:
Advice, Spice, Product = range(3)
class UsefulFactory:
def create_useful(self, type):
if type == UsefulType.Advice:
return Advice()
elif type == UsefulType.Product:
return Product()
else:
return Spice()