Modifies a number of hunt arguments.
963724
def Modify(self, client_limit=None, client_rate=None, duration=None):
    """"""
    args = hunt_pb2.ApiModifyHuntArgs(hunt_id=self.hunt_id)

    if client_limit is not None:
      args.client_limit = client_limit

    if client_rate is not None:
      args.client_rate = client_rate

    if duration is not None:
      args.duration = duration

    data = self._context.SendRequest("ModifyHunt", args)
    return Hunt(data=data, context=self._context)
1110647
function applyEach(fnList, args) {

   if( fnList ) {  
      head(fnList).apply(null, args);
      
      applyEach(tail(fnList), args);
   }
}
1354945
def increase_verbosity():
    
    defined_levels = sorted(set(find_defined_levels().values()))
    current_index = defined_levels.index(get_level())
    selected_index = max(0, current_index - 1)
    set_level(defined_levels[selected_index])
348573
def remove_arg(self, arg):
        """"""

        self.args = [arg_.strip() for arg_ in self.args if arg_.strip()]

        for arg_ in list(self.args):
            if arg_.lower() == arg.lower():
                self.args.remove(arg_)
496647
def StopHuntIfCrashLimitExceeded(hunt_id):
  """"""
  hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)

  # Do nothing if the hunt is already stopped.
  if hunt_obj.hunt_state == rdf_hunt_objects.Hunt.HuntState.STOPPED:
    return hunt_obj

  if hunt_obj.crash_limit:
    hunt_counters = data_store.REL_DB.ReadHuntCounters(hunt_id)
    if hunt_counters.num_crashed_clients >= hunt_obj.crash_limit:
      # Remove our rules from the forman and cancel all the started flows.
      # Hunt will be hard-stopped and it will be impossible to restart it.
      reason = ("Hunt %s reached the crashes limit of %d "
                "and was stopped.") % (hunt_obj.hunt_id, hunt_obj.crash_limit)
      StopHunt(hunt_obj.hunt_id, reason=reason)

  return hunt_obj
351681
private void handleArguments() {
        Bundle arguments = getArguments();

        if (arguments != null) {
            handleShowRestoreDefaultsButtonArgument(arguments);
            handleRestoreDefaultsButtonTextArgument(arguments);
        }
    }
796446
def modify(self, modification, parameters):
        
        for src in self:
            src.modify(modification, parameters)
1158039
function modify(fn) {
  if (~modifiers.indexOf(fn)) return false;

  modifiers.push(fn);
  return true;
}
963581
def modifie(self, key: str, value: Any) -> None:
        """"""
        if key in self.FIELDS_OPTIONS:
            self.modifie_options(key, value)
        else:
            self.modifications[key] = value
765956
private void add( final List<String> arguments,
                      final String argument )
    {
        if( argument != null && argument.trim().length() > 0 )
        {
            arguments.add( argument );
        }
    }
464302
def add_argument(self, dest, nargs=1, obj=None):
        
        if obj is None:
            obj = dest
        self._args.append(Argument(dest=dest, nargs=nargs, obj=obj))
747352
private static void appendArgument(StringBuilder argumentsAsString, int index, String argumentName,
                                       Object[] arguments) {
        argumentsAsString.append(argumentName);
        if (index != arguments.length - 1) {
            argumentsAsString.append(", ");
        }
    }
903305
def UpdateHunt(hunt_id, client_limit=None, client_rate=None, duration=None):
  """"""

  hunt_obj = data_store.REL_DB.ReadHuntObject(hunt_id)
  if hunt_obj.hunt_state != hunt_obj.HuntState.PAUSED:
    raise OnlyPausedHuntCanBeModifiedError(hunt_obj)

  data_store.REL_DB.UpdateHuntObject(
      hunt_id,
      client_limit=client_limit,
      client_rate=client_rate,
      duration=duration)
  return data_store.REL_DB.ReadHuntObject(hunt_id)
233305
def do_rmpostfix(self, arg):
        """"""
        altered = False
        if arg in self.curargs["functions"]:
            del self.curargs["functions"][arg]
            altered = True
        elif arg == "*":
            for varname in list(self.curargs["functions"].keys()):
                del self.curargs["functions"][varname]
            altered = True
        if altered:
            self.do_postfix("list")
11247
def ProcessHuntFlowLog(flow_obj, log_msg):
  """"""

  if not hunt.IsLegacyHunt(flow_obj.parent_hunt_id):
    return

  hunt_urn = rdfvalue.RDFURN("hunts").Add(flow_obj.parent_hunt_id)
  flow_urn = hunt_urn.Add(flow_obj.flow_id)
  log_entry = rdf_flows.FlowLog(
      client_id=flow_obj.client_id,
      urn=flow_urn,
      flow_name=flow_obj.flow_class_name,
      log_message=log_msg)
  with data_store.DB.GetMutationPool() as pool:
    grr_collections.LogCollection.StaticAdd(
        hunt_urn.Add("Logs"), log_entry, mutation_pool=pool)
493668
public function fixRepeatingArguments() {
        $either = [];
        foreach (static::transform($this)->children as $child) {
            $either[] = $child->children;
        }

        foreach ($either as $case) {
            $counts = [];
            foreach ($case as $child) {
                $ser = serialize($child);
                if (!isset($counts[$ser])) {
                    $counts[$ser] = ['cnt'=>0, 'items'=>[]];
                }

                $counts[$ser]['cnt']++;
                $counts[$ser]['items'][] = $child;
            }

            $repeatedCases = [];
            foreach ($counts as $child) {
                if ($child['cnt'] > 1) {
                    $repeatedCases = array_merge($repeatedCases, $child['items']);
                }
            }

            foreach ($repeatedCases as $e) {
                if ($e instanceof Argument || ($e instanceof Option && $e->argcount)) {
                    if (!$e->value) {
                        $e->value = [];
                    }
                    elseif (!is_array($e->value) && !$e->value instanceof \Traversable) {
                        $e->value = preg_split('/\s+/', $e->value);
                    }
                }
                if ($e instanceof Command || ($e instanceof Option && !$e->argcount)) {
                    $e->value = 0;
                }
            }
        }
        return $this;
    }
796961
def fix_repeating_arguments(self):
        """"""
        either = [list(child.children) for child in transform(self).children]
        for case in either:
            for e in [child for child in case if case.count(child) > 1]:
                if type(e) is Argument or type(e) is Option and e.argcount:
                    if e.value is None:
                        e.value = []
                    elif type(e.value) is not list:
                        e.value = e.value.split()
                if type(e) is Command or type(e) is Option and e.argcount == 0:
                    e.value = 0
        return self