seed.lib.merging package

Submodules

seed.lib.merging.merging module

seed.lib.merging.merging.get_attrs_with_mapping(data_set_buildings, mapping)

Returns a dictionary of attributes from each data_set_building.

Parameters:
  • data_set_buildings – list, instances to merge.
  • mapping
Returns:

dict: possible attributes keyed on attr name.

seed.lib.merging.merging.get_propertystate_attrs(data_set_buildings)
seed.lib.merging.merging.get_state_attrs(state_list)
seed.lib.merging.merging.get_taxlotstate_attrs(data_set_buildings)
seed.lib.merging.merging.merge_extra_data(b1, b2, default=None)

Merge extra_data field between two BuildingSnapshots, return result.

Parameters:
  • b1 – BuildingSnapshot inst.
  • b2 – BuildingSnapshot inst.
  • default – BuildingSnapshot inst.
Returns tuple of dict:
 
seed.lib.merging.merging.merge_state(merged_state, state1, state2, can_attrs, default=None)

Set attributes on our Canonical model, saving differences.

Parameters:
  • merged_state – PropertyState/TaxLotState model inst.
  • state1 – PropertyState/TaxLotState model inst. Left parent.
  • state2 – PropertyState/TaxLotState model inst. Right parent.
  • can_attrs – dict of dicts, {‘attr_name’: {‘dataset1’: ‘value’…}}.
  • default – (optional), which dataset’s value to default to.
Returns:

inst(merged_state), updated.

Module contents