4 self.
aList=[
'Module',
'ESSource']
7 "Checks if the first word of the line starts with any of the aList elements" 8 for item
in self.
aList:
9 if line.startswith(item):
14 "Reads the file line by line and searches for the begin and the end of each Module block" 15 aFile = open(nomefile)
19 insideModuleBlock =
False 20 insideParameterBlock =
False 21 for line
in aFile.readlines():
23 if insideParameterBlock:
24 file_modules[key]=module
25 insideParameterBlock =
False 28 module.append(line[:-1])
29 key=line[line.index(
':')+2:-1]
31 insideModuleBlock =
True 32 insideParameterBlock =
False 33 elif (line.startswith(
' parameters'))
and insideModuleBlock:
34 insideParameterBlock =
True 35 module.append(line[:-1])
37 elif line.startswith(
'ESModule')
and insideParameterBlock:
38 file_modules[key]=module
39 insideParameterBlock =
False 40 insideModuleBlock =
False 41 elif (insideParameterBlock):
42 module.append(line[:-1])
def startswith(self, line)
def readfile(self, nomefile)