It make sense to store this information under the Flow class to simplify functions calls and simplify access. So for example format_match_result could be written as:
def format_match_result(s: Flow, t: Flow, memo: str, is_match: bool):
if is_match:
result = {
'source': {
s.fields['uuid']: s.uuid,
s.fields['name']: s.name,
s.fields['context']: s.context.full
},
'target': {
t.fields['uuid']: t.uuid,
},
'conversionFactor': 1 if s.unit == t.unit else '?',
'MemoMapper': memo
}
else:
result = None
return result
Currently I pass a fields object containing field mapping information all over the place.
It make sense to store this information under the Flow class to simplify functions calls and simplify access. So for example
format_match_result
could be written as: