34 module_file =
open(fname,
'r')
35 module_data = module_file.read()
36 module_lines = module_data.splitlines()
38 for modules
in module_lines:
40 modules = modules.split()
42 if modules[0] ==
"else" and modules[1] ==
"if":
43 geographicalID = modules[2].
split(
'"')
44 modulename = geographicalID[1]
45 elif modules[0] ==
"if":
46 geographicalID = modules[1].
split(
'"')
47 modulename = geographicalID[1]
49 golden_modules.append(modulename)
52 for modules
in module_lines:
54 goldens = modules.split(
'=')
55 modules = modules.split()
57 if modules[0] ==
"else" and modules[1] ==
"if":
58 golden_hashID =
" : " + goldens[3].
split(
';')[0]
59 golden_bec = goldens[4].
split(
';')[0].strip()
60 golden_layer = goldens[5].
split(
';')[0].strip()
61 golden_phi = goldens[6].
split(
';')[0].strip()
62 golden_eta = goldens[7].
split(
';')[0].strip()
63 modulehash = golden_hashID +
" " + golden_bec +
"," + golden_layer +
"," + golden_phi +
"," + golden_eta
64 elif modules[0] ==
"if":
65 golden_hashIds = modules[4].
split(
';')[0]
66 golden_bec = modules[5].
split(
'=')[1].
split(
';')[0]
67 golden_layer = modules[6].
split(
'=')[1].
split(
';')[0]
68 golden_phi = modules[8].
split(
';')[0]
69 golden_eta = modules[10].
split(
';')[0].strip()
70 if len(golden_hashIds) == 1:
71 golden_hashID =
" : " + golden_hashIds
72 elif len(golden_hashIds) == 2:
73 golden_hashID =
" : " + golden_hashIds
74 elif len(golden_hashIds) == 3:
75 golden_hashID =
" : " + golden_hashIds
76 elif len(golden_hashIds) == 4:
77 golden_hashID =
" : " + golden_hashIds
78 modulehash = golden_hashID +
" " + golden_bec +
"," + golden_layer +
"," + golden_phi +
"," + golden_eta
80 golden_hash.append(modulehash)
81 return dict(zip(golden_modules, golden_hash))