forked from swimlane/soc-faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseclass.py
37 lines (29 loc) · 1.15 KB
/
baseclass.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
import uuid, random
class BaseClass(object):
random = random
def __init__(self):
self.uuid = uuid
def __str__(self):
return_dict = {}
for item in dir(self):
if not item.startswith('_') and item not in self.__dict__ and not item.startswith('random'):
return_dict[item] = getattr(self, item)
return str(return_dict)
def __repr__(self):
return_dict = {}
for item in dir(self):
if not item.startswith('_') and item not in self.__dict__ and not item.startswith('random'):
return_dict[item] = getattr(self, item)
return str(return_dict)
def __iter__(self):
return_dict = {}
for item in dir(self):
if not item.startswith('_') and item not in self.__dict__ and not item.startswith('random'):
return_dict[item] = getattr(self, item)
return iter(return_dict.items())
def _get_data(self, file_path):
return_list = []
with open(file_path, "r") as filehandle:
for item in filehandle.readlines():
return_list.append(item)
return return_list