Bridging method between flags and params, provided for efficient checks.
497352
public long toFlagsBitSet() {
      PersistenceMode persistenceMode = (PersistenceMode) params[PersistenceMode.ID].get();
      LockingMode lockingMode = (LockingMode) params[LockingMode.ID].get();
      ExecutionMode executionMode = (ExecutionMode) params[ExecutionMode.ID].get();
      StatisticsMode statisticsMode = (StatisticsMode) params[StatisticsMode.ID].get();
      ReplicationMode replicationMode = (ReplicationMode) params[ReplicationMode.ID].get();
      long flagsBitSet = 0;
      switch (persistenceMode) {
         case SKIP_PERSIST:
            flagsBitSet |= FlagBitSets.SKIP_CACHE_STORE;
            break;
         case SKIP_LOAD:
            flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD;
            break;
         case SKIP:
            flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD | FlagBitSets.SKIP_CACHE_STORE;
            break;
      }
      switch (lockingMode) {
         case SKIP:
            flagsBitSet |= FlagBitSets.SKIP_LOCKING;
            break;
         case TRY_LOCK:
            flagsBitSet |= FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT;
            break;
      }
      switch (executionMode) {
         case LOCAL:
            flagsBitSet |= FlagBitSets.CACHE_MODE_LOCAL;
            break;
         case LOCAL_SITE:
            flagsBitSet |= FlagBitSets.SKIP_XSITE_BACKUP;
            break;
      }
      if (statisticsMode == StatisticsMode.SKIP) {
         flagsBitSet |= FlagBitSets.SKIP_STATISTICS;
      }
      switch (replicationMode) {
         case SYNC:
            flagsBitSet |= FlagBitSets.FORCE_SYNCHRONOUS;
            break;
         case ASYNC:
            flagsBitSet |= FlagBitSets.FORCE_ASYNCHRONOUS;
            break;
      }
      return flagsBitSet;
   }
1332181
def parse_args(self, flags, namespace):
    """"""
    flag_value_map = self._create_flag_value_map(flags)

    mutex_map = defaultdict(list)
    for args, kwargs in self._unnormalized_option_registrations_iter():
      self._validate(args, kwargs)
      dest = self.parse_dest(*args, **kwargs)

      # Compute the values provided on the command line for this option.  Note that there may be
      # multiple values, for any combination of the following reasons:
      #   - The user used the same flag multiple times.
      #   - The user specified a boolean flag (--foo) and its inverse (--no-foo).
      #   - The option has multiple names, and the user used more than one of them.
      #
      # We also check if the option is deprecated, but we only do so if the option is explicitly
      # specified as a command-line flag, so we don't spam users with deprecated option values
      # specified in config, which isn't something they control.
      implicit_value = kwargs.get('implicit_value')
      if implicit_value is None and kwargs.get('type') == bool:
        implicit_value = True  # Allows --foo to mean --foo=true.

      flag_vals = []

      def add_flag_val(v):
        if v is None:
          if implicit_value is None:
            raise ParseError('Missing value for command line flag {} in {}'.format(
              arg, self._scope_str()))
          else:
            flag_vals.append(implicit_value)
        else:
          flag_vals.append(v)

      for arg in args:
        # If the user specified --no-foo on the cmd line, treat it as if the user specified
        # --foo, but with the inverse value.
        if kwargs.get('type') == bool:
          inverse_arg = self._inverse_arg(arg)
          if inverse_arg in flag_value_map:
            flag_value_map[arg] = [self._invert(v) for v in flag_value_map[inverse_arg]]
            implicit_value = self._invert(implicit_value)
            del flag_value_map[inverse_arg]

        if arg in flag_value_map:
          for v in flag_value_map[arg]:
            add_flag_val(v)
          del flag_value_map[arg]

      # Get the value for this option, falling back to defaults as needed.
      try:
        val = self._compute_value(dest, kwargs, flag_vals)
      except ParseError as e:
        # Reraise a new exception with context on the option being processed at the time of error.
        # Note that other exception types can be raised here that are caught by ParseError (e.g.
        # BooleanConversionError), hence we reference the original exception type as type(e).
        raise type(e)(
          'Error computing value for {} in {} (may also be from PANTS_* environment variables).'
          '\nCaused by:\n{}'.format(', '.join(args), self._scope_str(), traceback.format_exc())
        )

      # If the option is explicitly given, check deprecation and mutual exclusion.
      if val.rank > RankedValue.HARDCODED:
        self._check_deprecated(dest, kwargs)

        mutex_dest = kwargs.get('mutually_exclusive_group')
        if mutex_dest:
          mutex_map[mutex_dest].append(dest)
          dest = mutex_dest
        else:
          mutex_map[dest].append(dest)

        if len(mutex_map[dest]) > 1:
          raise self.MutuallyExclusiveOptionError(
            "Can only provide one of the mutually exclusive options {}".format(mutex_map[dest]))

      setattr(namespace, dest, val)

    # See if there are any unconsumed flags remaining.
    if flag_value_map:
      raise ParseError('Unrecognized command line flags on {}: {}'.format(
        self._scope_str(), ', '.join(flag_value_map.keys())))

    return namespace
913983
def _check_params(self,params):
        
        overridden_object_params = list(self._overridden.param)
        for item in params:
            if item not in overridden_object_params:
                self.param.warning("'%s' will be ignored (not a Parameter).",item)
1178968
def _check_params(ignored_variables, ignored_interactions):
    """"""

    if ignored_variables is None:
        ignored_variables = set()
    elif not isinstance(ignored_variables, abc.Container):
        ignored_variables = set(ignored_variables)

    if ignored_interactions is None:
        ignored_interactions = set()
    elif not isinstance(ignored_interactions, abc.Container):
        ignored_interactions = set(ignored_interactions)

    return ignored_variables, ignored_interactions
551910
private static Method resolveAmbiguousMethod(Set<Method> candidates,
            Class<?>[] paramTypes) {
        // Identify which parameter isn't an exact match
        Method m = candidates.iterator().next();

        int nonMatchIndex = 0;
        Class<?> nonMatchClass = null;

        for (int i = 0; i < paramTypes.length; i++) {
            if (m.getParameterTypes()[i] != paramTypes[i]) {
                nonMatchIndex = i;
                nonMatchClass = paramTypes[i];
                break;
            }
        }

        if (nonMatchClass == null) {
            // Null will always be ambiguous
            return null;
        }

        for (Method c : candidates) {
           if (c.getParameterTypes()[nonMatchIndex] ==
                   paramTypes[nonMatchIndex]) {
               // Methods have different non-matching parameters
               // Result is ambiguous
               return null;
           }
        }

        // Can't be null
        Class<?> superClass = nonMatchClass.getSuperclass();
        while (superClass != null) {
            for (Method c : candidates) {
                if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
                    // Found a match
                    return c;
                }
            }
            superClass = superClass.getSuperclass();
        }

        // Treat instances of Number as a special case
        Method match = null;
        if (Number.class.isAssignableFrom(nonMatchClass)) {
            for (Method c : candidates) {
                Class<?> candidateType = c.getParameterTypes()[nonMatchIndex];
                if (Number.class.isAssignableFrom(candidateType) ||
                        candidateType.isPrimitive()) {
                    if (match == null) {
                        match = c;
                    } else {
                        // Match still ambiguous
                        match = null;
                        break;
                    }
                }
            }
        }

        return match;
    }
667627
def []=(flag, value)
      if o = option(flag)
        o.value = value
      else
        raise ArgumentError, "no option with flag `#{flag}'"
      end
    end
851790
def _convert_params(sql, params):
    """"""
    args = [sql]
    if params is not None:
        if hasattr(params, 'keys'):  # test if params is a mapping
            args += [params]
        else:
            args += [list(params)]
    return args
213572
def has_flags(self, *flags):
        

        mask = sum(flags)
        return (self.bits & mask) == mask
582843
def split_args(self, args=None):
    
    goals = OrderedSet()
    scope_to_flags = {}

    def add_scope(s):
      # Force the scope to appear, even if empty.
      if s not in scope_to_flags:
        scope_to_flags[s] = []

    targets = []
    passthru = []
    passthru_owner = None

    self._unconsumed_args = list(reversed(sys.argv if args is None else args))
    # In regular use the first token is the binary name, so skip it. However tests may
    # pass just a list of flags, so don't skip it in that case.
    if not self._at_flag() and self._unconsumed_args:
      self._unconsumed_args.pop()
    if self._unconsumed_args and self._unconsumed_args[-1] == 'goal':
      # TODO: Temporary warning. Eventually specifying 'goal' will be an error.
      print("WARNING: Specifying 'goal' explicitly is no longer necessary, and deprecated.",
            file=sys.stderr)
      self._unconsumed_args.pop()

    def assign_flag_to_scope(flag, default_scope):
      flag_scope, descoped_flag = self._descope_flag(flag, default_scope=default_scope)
      if flag_scope not in scope_to_flags:
        scope_to_flags[flag_scope] = []
      scope_to_flags[flag_scope].append(descoped_flag)

    global_flags = self._consume_flags()

    add_scope(GLOBAL_SCOPE)
    for flag in global_flags:
      assign_flag_to_scope(flag, GLOBAL_SCOPE)
    scope, flags = self._consume_scope()
    while scope:
      if not self._check_for_help_request(scope.lower()):
        add_scope(scope)
        goals.add(scope.partition('.')[0])
        passthru_owner = scope
        for flag in flags:
          assign_flag_to_scope(flag, scope)
      scope, flags = self._consume_scope()

    while self._unconsumed_args and not self._at_double_dash():
      arg = self._unconsumed_args.pop()
      if arg.startswith('-'):
        # We assume any args here are in global scope.
        if not self._check_for_help_request(arg):
          assign_flag_to_scope(arg, GLOBAL_SCOPE)
      elif os.path.sep in arg or ':' in arg or os.path.isdir(arg):
        targets.append(arg)
      elif arg not in self._known_scopes:
        self._unknown_scopes.append(arg)

    if self._at_double_dash():
      self._unconsumed_args.pop()
      passthru = list(reversed(self._unconsumed_args))

    if self._unknown_scopes:
      self._help_request = UnknownGoalHelp(self._unknown_scopes)

    if not goals and not self._help_request:
      self._help_request = NoGoalHelp()

    return SplitArgs(goals, scope_to_flags, targets, passthru, passthru_owner if passthru else None, self._unknown_scopes)
1202794
public void assertAtLeastOneDefined(final String param1, final String param2) {
    if (!isPresent(param1) && !isPresent(param2)) {
      throw new ParameterException(
          String.format("At least one of %s and %s must be defined.", param1, param2));
    }
  }
1028510
function checkForDuplicates (params) {
  for (var i = 0; i < params.length - 1; i++) {
    var outer = params[i];
    for (var j = i + 1; j < params.length; j++) {
      var inner = params[j];
      if (outer.name === inner.name && outer.in === inner.in) {
        throw ono.syntax('Validation failed. Found multiple %s parameters named "%s"', outer.in, outer.name);
      }
    }
  }
}
530087
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
                         final MethodDeclaration method)
    {

        SqlFragment[] fragments = statement.getChildren();
        for (SqlFragment fragment : fragments) {

            // if the fragment is a container check all of its children.
            if (fragment instanceof SqlFragmentContainer) {
                doCheck((SqlFragmentContainer) fragment, paramMap, method);

                // reflection fragment - make sure it can be mapped using the method's param values.
            } else if (fragment instanceof ReflectionFragment) {
                checkReflectionFragment((ReflectionFragment) fragment, paramMap, method);
            }
        }
    }
1172845
def MOVS(self, params):
        
        Ra, Rb = self.get_two_parameters(self.TWO_PARAMETER_COMMA_SEPARATED, params)

        if self.is_immediate(Rb):
            self.check_arguments(low_registers=[Ra], imm8=[Rb])

            def MOVS_func():
                self.register[Ra] = self.convert_to_integer(Rb[1:])

                # Set N and Z status flags
                self.set_NZ_flags(self.register[Ra])

            return MOVS_func
        elif self.is_register(Rb):
            self.check_arguments(low_registers=(Ra, Rb))

            def MOVS_func():
                self.register[Ra] = self.register[Rb]

                self.set_NZ_flags(self.register[Ra])

            return MOVS_func
        else:
            raise iarm.exceptions.ParsingError("Unknown parameter: {}".format(Rb))
92366
def ifi_flags(self, value):
        """"""
        self.bytearray[self._get_slicers(4)] = bytearray(c_uint(value or 0))
155434
public static boolean sanityCheck(int flags) {
		doCheck(flags, ConformanceFlags.CHECKED | ConformanceFlags.UNCHECKED);
		if ((flags & ConformanceFlags.UNCHECKED) == 0) {
			doCheck(flags, ConformanceFlags.CHECK_RESULTS);
		} else if ((flags & (ConformanceFlags.SEALED | ConformanceFlags.CHECK_RESULTS)) != 0) {
			throw new IllegalArgumentException("Invalid flags: " + toString(flags));
		}
		return true;
	}
355751
public function processParamsAndDepends(& $params, & $neighbouring_values, $options, $flag_params = true) {
		foreach ($params as $k => $v) {
			if (is_array($v)) continue;
			// if we have a parent
			if (strpos($v, 'parent::') !== false) { // value from parent
				$field = str_replace(['parent::', 'static::'], '', $v);
				if (!empty($this->errors['fields'][$field]['danger'])) {
					$params[$k] = null;
				} else {
					$params[$k] = $this->values[$field] ?? null;
				}
			} else if (strpos($v, 'detail::') !== false) { // if we need to grab value from detail
				$field = str_replace('detail::', '', $v);
				$params[$k] = $neighbouring_values[$field] ?? $options['options']['__detail_values'][$field] ?? null;
			} else if ($flag_params) {
				// todo process errors
				// todo process details
				if (!empty($this->fields[$v]['options']['multiple_column']) && is_array(current($neighbouring_values[$v] ?? []))) {
					$params[$k] = array_extract_values_by_key($neighbouring_values[$v] ?? [], $this->fields[$v]['options']['multiple_column']);
				} else {
					$params[$k] = $neighbouring_values[$v] ?? null;
				}
			}
		}
	}
1148929
def _check(self, args):
        """"""
        if sum(bool(args[arg]) for arg in self._mapping) > 1:
            raise DocoptExit(_('These options are mutually exclusive: {0}',
                               ', '.join(self._mapping)))