def UpdateHuntObject(self, hunt_id, start_time=None, **kwargs):
    """Updates the hunt object by applying the update function."""
    hunt_obj = self.ReadHuntObject(hunt_id)

    delta_suffix = "_delta"

    for k, v in kwargs.items():
      if v is None:
        continue

      if k.endswith(delta_suffix):
        key = k[:-len(delta_suffix)]
        current_value = getattr(hunt_obj, key)
        setattr(hunt_obj, key, current_value + v)
      else:
        setattr(hunt_obj, k, v)

    if start_time is not None:
      hunt_obj.init_start_time = hunt_obj.init_start_time or start_time
      hunt_obj.last_start_time = start_time

    hunt_obj.last_update_time = rdfvalue.RDFDatetime.Now()
    self.hunts[hunt_obj.hunt_id] = hunt_obj
def UpdateHuntObject ( self , hunt_id , start_time = None , ** kwargs ) : hunt_obj = self . ReadHuntObject ( hunt_id ) delta_suffix = "_delta" for k , v in kwargs . items ( ) : if v is None : continue if k . endswith ( delta_suffix ) : key = k [ : - len ( delta_suffix ) ] current_value = getattr ( hunt_obj , key ) setattr ( hunt_obj , key , current_value + v ) else : setattr ( hunt_obj , k , v ) if start_time is not None : hunt_obj . init_start_time = hunt_obj . init_start_time or start_time hunt_obj . last_start_time = start_time hunt_obj . last_update_time = rdfvalue . RDFDatetime . Now ( ) self . hunts [ hunt_obj . hunt_id ] = hunt_obj
Updates the hunt object by applying the update function.