MCPcopy Create free account
hub / github.com/comaps/comaps / merge

Function merge

tools/python/openlr/quality.py:202–228  ·  view source on GitHub ↗
(src, dst)

Source from the content-addressed store, hash-verified

200 return result
201
202def merge(src, dst):
203 # If segment was ignored it does not have a golden route.
204 # We should mark the corresponding route in dst as ignored too.
205 golden_routes = {
206 int(s.find('.//ReportSegmentID').text): s.find('GoldenRoute')
207 for s in src.findall('Segment')
208 }
209 ignored_routes = {
210 int(s.find('.//ReportSegmentID').text): s.find('Ignored')
211 for s in src.findall('Segment')
212 }
213 for s in dst.findall('Segment'):
214 assert not s.find('GoldenRoute')
215 assert not s.find('Ignored')
216
217 reportSegmentID = int(s.find('.//ReportSegmentID').text)
218 golden_route = golden_routes[reportSegmentID]
219 ignored_route = ignored_routes[reportSegmentID]
220
221 if ignored_route is not None and ignored_route.text == 'true':
222 elem = ET.Element('Ignored')
223 elem.text = 'true'
224 s.append(elem)
225 continue
226
227 if golden_route:
228 s.append(golden_route)
229
230if __name__ == '__main__':
231 import argparse

Callers 2

quality.pyFile · 0.85
MergeDictionariesFunction · 0.85

Calls 3

ElementMethod · 0.80
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected