-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilder.py
42 lines (31 loc) · 898 Bytes
/
builder.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
class Notebook:
def __init__(self, ram=None, ssd=None, cpu=None):
self.ram = ram
self.ssd = ssd
self.cpu = cpu or "intel"
class NotebookBuilder:
def __init__(self):
self.note = Notebook()
def set_ram(self, ram):
self.note.ram = ram
return self
def set_ssd(self, ssd):
self.note.ssd = ssd
return self
def set_cpu(self, cpu):
self.note.cpu = cpu
return self
def build(self) -> Notebook:
""" retorna a instancia pronta """
# if self.ram is None:
# raise Exception()
return self.note
if __name__ == "__main__":
note = (NotebookBuilder()
.set_ram(32)
.set_ssd(512)
.set_cpu("amd")
.build())
note2 = (NotebookBuilder()
.set_cpu("amd")
.build())