def __init__(self, field): """Constructor. :param field: dot separated path to the EDTF field to process. """ super(EDTFDumperExt, self).__init__() self.keys = parse_lookup_key(field) self.key = self.keys[-1]
def __init__(self, target_field): """Constructor. :param target_field: dot separated path where to dump the tokens. """ super().__init__() self.keys = parse_lookup_key(target_field) self.key = self.keys[-1]
def __init__(self, list_field, key): """Constructor. :param list_field: dot-separated path to the array to process. :param key: name of the (scalar) EDTF field. This field has to be present in each array item. In contrast to `list_field`, this should be a simple field name (and not a dot-separated path). """ super(EDTFListDumperExt, self).__init__() self.keys = parse_lookup_key(list_field) self.key = key self.range_key = "{}_range".format(self.key)
def pre_load(self, data, **kwargs): """Called before a record is dumped in a secondary storage system.""" if self._dump: keys = parse_lookup_key(self.attr_name) parent = dict_lookup(data, keys, parent=True) parent.pop(keys[-1], None)