12 self.
aList=[
'Module',
'ESSource']
15 "Checks if the first word of the line starts with any of the aList elements" 16 for item
in self.
aList:
17 if line.startswith(item):
22 "Reads the file line by line and searches for the begin and the end of each Module block" 23 aFile = open(nomefile)
29 insideModuleBlock =
False 30 insideParameterBlock =
False 33 for line
in aFile.readlines():
34 if line.startswith(
"Processing History:"):
37 elif (
not line.startswith(
'---------Event'))
and processHistory:
38 splitLine= line.split()
39 if splitLine[3]==
'[2]':
44 elif line.startswith(
'---------Event')
and processing:
45 file_modules[
'Processing']=value
49 if insideParameterBlock:
50 module.append(
tuple(value))
51 file_modules[key].
append(module)
52 insideParameterBlock =
False 53 insideModuleBlock =
False 56 splitLine= line.split()
58 if key
not in file_modules.keys():
60 module.append(splitLine[-2])
61 value.append(line[:-1])
62 insideModuleBlock =
True 63 insideParameterBlock =
False 64 elif (line.startswith(
' parameters'))
and insideModuleBlock:
65 insideParameterBlock =
True 66 value.append(line[:-1])
67 elif line.startswith(
'ESModule')
and insideParameterBlock:
68 module.append(
tuple(value))
69 file_modules[key].
append(module)
70 insideParameterBlock =
False 71 insideModuleBlock =
False 77 elif (insideParameterBlock):
78 value.append(line[:-1])
80 if insideParameterBlock:
81 module.append(
tuple(value))
82 file_modules[key].
append(module)
83 insideParameterBlock =
False 84 insideModuleBlock =
False
def readfile(self, nomefile)
def __init__(self, label='', value=[])
def startswith(self, line)