|
from re import search |
|
|
|
phases = ["iFAT", "(i)SAT"] |
|
|
|
inputPhases = {**{i: k for i, k in enumerate(phases)}, **{len(phases): "All"}} |
|
|
|
exitinput = {"no", "n", "0"} |
|
|
|
|
|
def printOptions(): |
|
print("\nchoose one of the following options;\n") |
|
for key in inputPhases: |
|
print("[%d] %s" % (key, inputPhases[key])) |
|
print() |
|
|
|
|
|
def getObjectsPerPhase(phase: str = "All"): |
|
f = open("./objecten.txt", "r") |
|
t = f.read().split("\n\n") |
|
f.close() |
|
|
|
objs = {p: [] for p in phases} |
|
if phase in phases: |
|
objs = {phase:[]} |
|
|
|
regObject = r"\d{4}[a-zA-Z]{2}" |
|
for g in t: |
|
ls = g.split("\n") |
|
k = ls[0] |
|
if k in objs: |
|
objs[k] = ls[1::] |
|
else: |
|
print("key [%s] is not recognized" % k) |
|
|
|
objs = {k: objs[k] for k in objs if objs[k]} |
|
|
|
for k in objs: |
|
for i, o in enumerate(objs[k]): |
|
m = search(regObject, o) |
|
if not m: |
|
continue |
|
objs[k][i] = m.group(0) |
|
|
|
return objs |
|
|