示例#1
0
 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)
示例#2
0
 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
示例#3
0
def test_fqfield_from_fqid_and_field():
    fqid = "a/1"
    field = "f"

    assert fqfield_from_fqid_and_field(fqid, field) == "a/1/f"
示例#4
0
 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()
     ]
示例#5
0
 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()
     }