CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Public Attributes
python.readProv.filereader Class Reference

Classes

class  Module
 

Public Member Functions

def __init__
 
def readfile
 
def startswith
 

Public Attributes

 aList
 

Detailed Description

Definition at line 4 of file readProv.py.

Constructor & Destructor Documentation

def python.readProv.filereader.__init__ (   self)

Definition at line 11 of file readProv.py.

11 
12  def __init__(self):
13  self.aList=['Module', 'ESSource']

Member Function Documentation

def python.readProv.filereader.readfile (   self,
  nomefile 
)

Definition at line 21 of file readProv.py.

References bitset_utilities.append(), python.read_provenance.filereader.startswith(), and python.readProv.filereader.startswith().

21 
22  def readfile(self,nomefile):
23  "Reads the file line by line and searches for the begin and the end of each Module block"
24  aFile = open(nomefile)
25  module=[]
26  value=[]
27  file_modules = {}
28  processHistory=False
29  processing=False
30  insideModuleBlock = False
31  insideParameterBlock = False
32  nprocess=-1
33  key=''
34  for line in aFile.readlines():
35  if line.startswith("Processing History:"):
36  value=[]
37  processHistory=True
38  elif (not line.startswith('---------Event')) and processHistory:
39  splitLine= line.split()
40  if splitLine[3]=='[2]':
41  processing=True
42  value.append(line)
43  elif processing:
44  value.append(line)
45  elif line.startswith('---------Event') and processing:
46  file_modules['Processing']=value
47  processHistory=False
48  processing=False
49  elif self.startswith(line):
50  if insideParameterBlock:
51  module.append(tuple(value))
52  file_modules[key].append(module)
53  insideParameterBlock = False
54  insideModuleBlock = False ###controllare
55  value=[]
56  module=[]
57  splitLine= line.split()
58  key=splitLine[-1]
59  if key not in file_modules.keys():
60  file_modules[key]=[]
61  module.append(splitLine[-2])
62  value.append(line[:-1])
63  insideModuleBlock = True
64  insideParameterBlock = False
65  elif (line.startswith(' parameters')) and insideModuleBlock:
66  insideParameterBlock = True
67  value.append(line[:-1])
68  elif line.startswith('ESModule') and insideParameterBlock:
69  module.append(tuple(value))
70  file_modules[key].append(module)
71  insideParameterBlock = False
72  insideModuleBlock = False
73  #elif line=='}' and insideParameterBlock:
74  #module.append(tuple(value))
75  #file_modules[key].append(module)
76  #insideParameterBlock = False
77  #insideModuleBlock = False
78  elif (insideParameterBlock):
79  value.append(line[:-1])
80 
81  if insideParameterBlock:
82  module.append(tuple(value))
83  file_modules[key].append(module)
84  insideParameterBlock = False
85  insideModuleBlock = False
86 
87 
88  return file_modules
89 
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
def python.readProv.filereader.startswith (   self,
  line 
)

Definition at line 14 of file readProv.py.

References python.read_provenance.filereader.aList, and python.readProv.filereader.aList.

Referenced by python.readProv.filereader.readfile().

14 
15  def startswith(self,line):
16  "Checks if the first word of the line starts with any of the aList elements"
17  for item in self.aList:
18  if line.startswith(item):
19  return True
20  return False

Member Data Documentation

python.readProv.filereader.aList

Definition at line 12 of file readProv.py.

Referenced by python.readProv.filereader.startswith().