Factory method for producing a search criteria sub-class from a
        search key.

        Args:
            key: The search key defining the criteria.
            params: The parameters that may be used by some searches.
558356
def of(cls, key: SearchKey, params: SearchParams) -> 'SearchCriteria':
        
        key_name = key.value
        if key_name in params.disabled:
            raise SearchNotAllowed(key_name)
        elif key.inverse:
            return InverseSearchCriteria(key.not_inverse, params)
        elif key_name == b'SEQSET':
            return SequenceSetSearchCriteria(key.filter_sequence_set, params)
        elif key_name == b'KEYSET':
            return SearchCriteriaSet(key.filter_key_set, params)
        elif key_name == b'ALL':
            return AllSearchCriteria(params)
        elif key_name == b'OR':
            left_key, right_key = key.filter_key_or
            return OrSearchCriteria(left_key, right_key, params)
        elif key_name == b'ANSWERED':
            return HasFlagSearchCriteria(Answered, True, params)
        elif key_name == b'UNANSWERED':
            return HasFlagSearchCriteria(Answered, False, params)
        elif key_name == b'DELETED':
            return HasFlagSearchCriteria(Deleted, True, params)
        elif key_name == b'UNDELETED':
            return HasFlagSearchCriteria(Deleted, False, params)
        elif key_name == b'DRAFT':
            return HasFlagSearchCriteria(Draft, True, params)
        elif key_name == b'UNDRAFT':
            return HasFlagSearchCriteria(Draft, False, params)
        elif key_name == b'FLAGGED':
            return HasFlagSearchCriteria(Flagged, True, params)
        elif key_name == b'UNFLAGGED':
            return HasFlagSearchCriteria(Flagged, False, params)
        elif key_name == b'RECENT':
            return HasFlagSearchCriteria(Recent, True, params)
        elif key_name == b'OLD':
            return HasFlagSearchCriteria(Recent, False, params)
        elif key_name == b'SEEN':
            return HasFlagSearchCriteria(Seen, True, params)
        elif key_name == b'UNSEEN':
            return HasFlagSearchCriteria(Seen, False, params)
        elif key_name == b'KEYWORD':
            return HasFlagSearchCriteria(key.filter_flag, True, params)
        elif key_name == b'UNKEYWORD':
            return HasFlagSearchCriteria(key.filter_flag, False, params)
        elif key_name == b'NEW':
            return NewSearchCriteria(params)
        elif key_name == b'BEFORE':
            return DateSearchCriteria(key.filter_datetime, '<', params)
        elif key_name == b'ON':
            return DateSearchCriteria(key.filter_datetime, '=', params)
        elif key_name == b'SINCE':
            return DateSearchCriteria(key.filter_datetime, '>=', params)
        elif key_name == b'SENTBEFORE':
            return HeaderDateSearchCriteria(key.filter_datetime, '<', params)
        elif key_name == b'SENTON':
            return HeaderDateSearchCriteria(key.filter_datetime, '=', params)
        elif key_name == b'SENTSINCE':
            return HeaderDateSearchCriteria(key.filter_datetime, '>=', params)
        elif key_name == b'SMALLER':
            return SizeSearchCriteria(key.filter_int, '<', params)
        elif key_name == b'LARGER':
            return SizeSearchCriteria(key.filter_int, '>', params)
        elif key_name in (b'BCC', b'CC', b'FROM', b'SUBJECT', b'TO'):
            return EnvelopeSearchCriteria(key_name, key.filter_str, params)
        elif key_name == b'HEADER':
            name, value = key.filter_header
            return HeaderSearchCriteria(name, value, params)
        elif key_name in (b'BODY', b'TEXT'):
            return BodySearchCriteria(key.filter_str, params)
        raise SearchNotAllowed(key_name)
784082
def parse_searching_param(searching_param, allowed_params)
      return {} unless searching_param.present?

      fields = {}

      # Extract the fields for each type from the fields parameters
      if searching_param.is_a?(Hash)
        searching_param.each do |field, value|
          resource_fields = value.split(',') unless value.nil? || value.empty?
          fields[field.to_sym] = resource_fields
        end
      else
        raise InvalidSearchException, "Invalid search format for #{searching_param}"
      end
      check_searching_param(fields, allowed_params)
      fields
    end
395941
def build_parameter(field: Field) -> Mapping[str, Any]:
    
    builder = Parameters()
    return builder.build(field)
136218
def keys(cls, name, hash_key, range_key=None, throughput=None):
        
        return cls(cls.KEYS, name, hash_key, range_key,
                   throughput=throughput)
992811
def _construct_url(self, base_api, params):
        
        params['key'] = self.api_key
        return super(OpenMapQuest, self)._construct_url(base_api, params)
332466
def _construct_params(params, required_keys, opt_keys=None):
        
        try:
            params_list = [params.pop(key) for key in required_keys]
        except KeyError as e:
            raise MissingParameter(
                'Missing expected request parameter: %s' % e)
        if opt_keys:
            params_list.extend([params.pop(key)
                                for key in opt_keys if key in params])
        return '/'.join(str(p) for p in params_list)
65600
def query_params(self, params, key, def_value, short_hand=None):
    
    if key not in params and short_hand:
        # value is associated with shorthand, move to key
        params[key] = params.get(short_hand, def_value)
        del params[short_hand]
    elif key not in params and not short_hand:
        params[key] = def_value
    elif key in params:
        # key is there, also possibly shorthand
        # assume def value at this point is not needed
        if short_hand in params:
            del params[short_hand]
    return params
582570
def filter_params(params):
    
    if params is not None:
        new_params = copy.deepcopy(params)
        new_params = dict((k, v) for k, v in new_params.items() if v is not None)
        for key, value in new_params.items():
            if isinstance(value, bool):
                new_params[key] = "true" if value else "false"
        return new_params
1205662
def key(self, key=""):
    
    params = join_params(self.parameters, {"key": key})

    return self.__class__(**params)
1227577
def append_query_param(self, key, value):
        
        values = self.query_param(key, as_list=True, default=[])
        values.append(value)
        return self.query_param(key, values)
1252715
public static String lookupParameterValue(String key, String string) {
		Pattern p = Pattern.compile("\\[" + key + "=[^\\]]*\\]");
		Matcher m = p.matcher(string);
		m.find();
    	String f = m.group();
    	int p1 = f.indexOf('=');
    	int p2 = f.indexOf(']');
    	return f.substring(p1+1, p2);
	}
1126906
def prepare_params(params)
      # Create a new hash in case is a HashWithIndifferentAccess (keys are
      # always a String)
      params = Utils.symbolize_keys(Hash[params])
      # Only pull out the relevant parameters, other won't be included in the
      # signature so will cause false negatives
      keys = [:resource_id, :resource_type, :resource_uri, :state, :signature]
      params = Hash[params.select { |k,v| keys.include? k }]
      (keys - [:state]).each do |key|
        raise ArgumentError, "Parameters missing #{key}" if !params.key?(key)
      end
      params
    end
187047
def from_key(cls, *args):
        
        key = args if len(args) > 1 else args[0]
        return cls._instances.get(key, None)
343076
def get(self, key):
        
        if key == None or key == '':
            return None
        elif key.find('.') > 0:
            return RecursiveObjectReader.get_property(self, key)
        else:
            return super(Parameters, self).get(key)
322825
def _prepare_key(key, *args, **kwargs):
    

    if not args and not kwargs:
        return key

    items = sorted(kwargs.items())
    hashable_args = (args, tuple(items))
    args_key = hashlib.md5(pickle.dumps(hashable_args)).hexdigest()

    return "%s/args:%s" % (key, args_key)
1121187
def _build_list_params(param_name, key, values):
        """"""
        params = {}
        if hasattr(values, '__iter__'):
            index = 0
            for value in values:
                params[str(param_name) + '[' + str(index) + '].' + str(key)] = str(value)
                index += 1
        else:
            params[str(param_name) + '[0].' + str(key)] = str(values)
        return params
181429
def from_api_repr(cls, resource):
        
        name = resource.get("name")
        type_ = resource["parameterType"]["type"]
        value = resource["parameterValue"]["value"]
        converted = _QUERY_PARAMS_FROM_JSON[type_](value, None)
        return cls(name, type_, converted)