-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmenuabc.py
More file actions
41 lines (31 loc) · 910 Bytes
/
menuabc.py
File metadata and controls
41 lines (31 loc) · 910 Bytes
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
from abc import ABC, abstractmethod
class MenuComponent(ABC):
'''Item do cardápio, com sub-itens'''
def append(self, item):
'''incluir sub-item'''
raise NotImplementedError()
def remove(self, item):
'''remover sub-item'''
raise NotImplementedError()
def __getitem__(self, i):
'''obter sub-item pelo índice'''
raise NotImplementedError()
@property
@abstractmethod
def name(self):
'''obter nome do item'''
@property
@abstractmethod
def description(self):
'''obter descrição do item'''
@property
def price(self):
'''obter preço do item'''
raise NotImplementedError()
@property
@abstractmethod
def is_vegetarian(self):
'''obter booleano indicador de item vegetariano'''
@abstractmethod
def display(self):
'''exibir item e sub-itens'''