def get_modified_fqfields( self, events: List[BaseDbEvent], position: int ) -> List[str]: modified_fqfields = set() for event in events: fqfields = self.get_modified_fqfields_from_event(event) modified_fqfields.update(fqfields) meta_position_fqfield = fqfield_from_fqid_and_field( event.fqid, META_POSITION ) modified_fqfields.add(meta_position_fqfield) return list(modified_fqfields)
def get_modified_fqfields( self, events: List[BaseDbEvent], position: int ) -> Dict[str, str]: modified_fqfields = {} for event in events: fqfields = self.get_modified_fqfields_from_event(event) modified_fqfields.update(fqfields) meta_position_fqfield = fqfield_from_fqid_and_field( event.fqid, META_POSITION ) modified_fqfields[meta_position_fqfield] = str(position) return modified_fqfields
def test_fqfield_from_fqid_and_field(): fqid = "a/1" field = "f" assert fqfield_from_fqid_and_field(fqid, field) == "a/1/f"
def get_modified_fqfields_from_event(self, event: BaseDbEvent) -> List[str]: return [ fqfield_from_fqid_and_field(event.fqid, field) for field in event.get_modified_fields() ]
def get_modified_fqfields_from_event(self, event: BaseDbEvent) -> Dict[str, str]: return { fqfield_from_fqid_and_field(event.fqid, field): json.dumps(value) for field, value in event.get_modified_fields().items() }