-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal.py
29 lines (24 loc) · 851 Bytes
/
internal.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
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import List, Optional
@dataclass
class AnyDataModelName:
b: List[str]
a: Optional[int] = None
c: Optional[datetime] = None
def do_some_stuff(self, any_param: int) -> bool:
if self.a is not None:
return self.a == any_param
return False
def do_any_other_stuff(self, days_timedelta: int) -> bool:
if self.c is None:
return False
if self.c + timedelta(days=days_timedelta) <= datetime(2020, 1, 1):
return True
return False
def do_some_extra_stuff(self) -> str:
if self.a is None:
raise ValueError('a is None')
for index, item in enumerate(self.b):
self.b[index] = f'{item}_{index}_{self.a}'
return ','.join(self.b)