forked from Sean-Bradley/Design-Patterns-In-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcube_a.py
More file actions
24 lines (20 loc) · 729 Bytes
/
cube_a.py
File metadata and controls
24 lines (20 loc) · 729 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
# pylint: disable=too-few-public-methods
"A Class of Cube from Company A"
import time
from interface_cube_a import ICubeA
class CubeA(ICubeA):
"A hypothetical Cube tool from company A"
# a static variable indicating the last time a cube was manufactured
last_time = int(time.time())
def __init__(self):
self.width = self.height = self.depth = 0
def manufacture(self, width, height, depth):
self.width = width
self.height = height
self.depth = depth
# if not busy, then manufacture a cube with dimensions
now = int(time.time())
if now > int(CubeA.last_time + 1):
CubeA.last_time = now
return True
return False # busy