-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloader.py
More file actions
29 lines (22 loc) · 774 Bytes
/
Copy pathloader.py
File metadata and controls
29 lines (22 loc) · 774 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
# Helper class to load in different kinds of
class DataLoader():
def __init__(self):
pass
@classmethod
def loadData(self, filename):
pass
@classmethod
def loadMaps(self, mapTypes):
maps = {}
for mapType in mapTypes:
# If it is serial, it does not have a lookup table. Otherwise, pull its lookup table, and load it into the `maps` variable
if not mapType[0] in ["serial", "pernum", "momloc", "hrsmain"]:
with open("./maps/" + mapType[0] + "_map.txt") as f:
mappings = f.readlines()
mappings = [m.split("\t\t") for m in mappings]
mappings = [[m[0], m[1].strip("\n")] for m in mappings]
thisMap = {}
for (k,v) in mappings:
thisMap.setdefault(k,v)
maps.setdefault(mapType[0], thisMap)
return maps