-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchetype.py
More file actions
39 lines (29 loc) · 1.09 KB
/
Copy patharchetype.py
File metadata and controls
39 lines (29 loc) · 1.09 KB
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
from datetime import datetime
from duration_operations import parse_timedelta, duration_convert
class Archetype:
def __init__():
self.states = []
self.currentState = ''
def from_(self, state_from, state_to):
if self.currentState == state_from:
self.currentState = state_to
def state(self, state: str):
if state in self.states:
return state
def transfer(self, value):
print(f"transferred {value}")
def now(self):
return datetime.now().date()
def called_by(self, user):
print(f"called by {user}")
def strptime(self, date_string, format):
return datetime.strptime(date_string, format)
def parse_timedelta(self, duration_string):
return parse_timedelta(duration_string)
def duration_convert(self, maybe_duration):
return duration_convert(maybe_duration)
def header(func):
def wrapper(self, *args, **kwargs):
transferred = 100
return func(self, *args, **kwargs, transferred=transferred)
return wrapper