def get_elements(self):
summary = etree.Element(Summary.SUMMARY,
- {'version': unicode(Summary.XML_VERSION)})
+ {'version': str(Summary.XML_VERSION)})
for end in self.lane_results:
- for lane in end.values():
+ for lane in list(end.values()):
summary.append(lane.get_elements())
return summary
Debugging function, report current object
"""
tree = self.get_elements()
- print etree.tostring(tree)
+ print(etree.tostring(tree))
class SummaryGA(Summary):
def __init__(self, filename=None, xml=None):
('Lane Results Summary : Read 1', 0),
('Lane Results Summary : Read 2', 1),]
for name, end in table_names:
- if tables.has_key(name):
+ if name in tables:
self._extract_lane_results_for_end(tables, name, end)
if len(self.lane_results[0]) == 0:
def get_elements(self):
lane_result = etree.Element(
LaneResultSummary.LANE_RESULT_SUMMARY,
- {'lane': unicode(self.lane), 'end': unicode(self.end)})
- for tag, variable_name in LaneResultSummary.TAGS.items():
+ {'lane': str(self.lane), 'end': str(self.end)})
+ for tag, variable_name in list(LaneResultSummary.TAGS.items()):
value = getattr(self, variable_name)
if value is None:
continue
# it looks like a sequence
- elif type(value) in (types.TupleType, types.ListType):
+ elif type(value) in (tuple, list):
element = make_mean_range_element(
lane_result,
tag,
)
else:
element = etree.SubElement(lane_result, tag)
- element.text = unicode(value)
+ element.text = str(value)
return lane_result
def set_elements(self, tree):
variable_name = tags[element.tag]
setattr(self, variable_name,
parse_summary_element(element))
- except KeyError, e:
+ except KeyError as e:
LOGGER.warn('Unrecognized tag %s' % (element.tag,))
else:
self.lane_yield = None
- for GeraldName, LRSName in LaneResultSummary.GERALD_TAGS.items():
+ for GeraldName, LRSName in list(LaneResultSummary.GERALD_TAGS.items()):
node = element.find(GeraldName)
if node is None:
LOGGER.info("Couldn't find %s" % (GeraldName))
"""
try:
v = int(v)
- except ValueError, e:
+ except ValueError as e:
v = float(v)
return v
Make an etree subelement <Name mean='mean', deviation='deviation'/>
"""
element = etree.SubElement(parent, name,
- { 'mean': unicode(mean),
- 'deviation': unicode(deviation)})
+ { 'mean': str(mean),
+ 'deviation': str(deviation)})
return element
def parse_mean_range_element(element):