Internal: Find all qvalue matches from an Array of available options.

 Adapted from Rack::Utils#q_values.

 Returns Array of matched Strings from available Array or [].
491522
def find_q_matches(q_values, available, &matcher)
      matcher ||= lambda { |a, b| a == b }

      matches = []

      case q_values
      when Array
      when String
        q_values = parse_q_values(q_values)
      when NilClass
        q_values = []
      else
        raise TypeError, "unknown q_values type: #{q_values.class}"
      end

      q_values.each do |accepted, quality|
        if match = available.find { |option| matcher.call(option, accepted) }
          matches << [match, quality]
        end
      end

      matches.sort_by! { |match, quality| -quality }
      matches.map! { |match, quality| match }
      matches
    end
985371
def get_applicable_values(self):
        """"""
        return [v for v in self._values if v.is_active and not v.is_all_results]
912412
def get_values(text):
    

    res = re.findall(r"\[(.*?)\]", text)
    values = []

    for r in res:
        if "|" in r:
            params = r.split("|")
            for p in params:
                values.append(p)
        else:
            values.append(r)

    values = [str(v.lower()) for v in values]

    return values
1253628
def if_match(self):
        
        value = []
        for option in self.options:
            if option.number == defines.OptionRegistry.IF_MATCH.number:
                value.append(option.value)
        return value
363406
def _parse_args( self, q, args, values):
        '''
        
        '''
        if wx.GetApp() is None:
            self.app = wx.App( False )

        # preprocess command line arguments and set to defaults
        option_values, args = self.SUPER.parse_args(self, args, values)
        for option in self.option_list:
            if option.dest and hasattr(option_values, option.dest):
                default = getattr(option_values, option.dest)
                if default is not None:
                    option.default = default

        dlg = OptparseDialog( option_parser = self, title=self.get_description() )

        if args:
            dlg.args_ctrl.Value = ' '.join(args)

        dlg_result = dlg.ShowModal()
        if wx.ID_OK != dlg_result:
            raise UserCancelledError( 'User has canceled' )

        if values is None:
            values = self.get_default_values()

        option_values, args = dlg.getOptionsAndArgs()

        for option, value in option_values.iteritems():
            if ( 'store_true' == option.action ) and ( value is False ):
                setattr( values, option.dest, False )
                continue
            if ( 'store_false' == option.action ) and ( value is True ):
                setattr( values, option.dest, False )
                continue

            if option.takes_value() is False:
                value = None

            option.process( option, value, values, self )

        q.put((values, args))
858750
function findPaths(schema, options) {
  const paths = [];

  schema.eachPath(function(path, type) {
    if (type.enumValues && type.enumValues.length) {
      paths.push(
        {
          path: path,
          enumValues: type.enumValues,
          options: options
        }
      );
    }
  });

  return filterPaths(paths, options);
}
1121143
function (qs) {
        var items = qs.split('&');
        var options = {};
        items = items.filter(function (item) {
            return item.match(/^[\w_-]+=?$|^[\w_-]+=[^=]+$/);
        }).forEach(function (item) {
            var kv = item.split('=');
            var value = kv[1];
            if (value === undefined || value === '') {
                value = true;
            }
            else if (value.toLowerCase() === 'false') {
                value = false;
            }
            options[kv[0]] = value;
        });

        return options;
    }
861002
def select_values values
      return unless values
      values.each do |val|
        row = @list.index val
        add_row_selection_interval row, row unless row.nil?
      end
    end
1140483
def [](k)
      if RESERVED_FIELDS.include? k.to_sym
        super
      else
        r = attributes.find {|a| a.key.to_s == k.to_s }.value
      end
    end
261743
def all_strings(arr):
        
        if not isinstance([], list):
            raise TypeError("non-list value found where list is expected")
        return all(isinstance(x, str) for x in arr)
318092
public List<String> getMatchingOptions(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);
        
        List<String> matchingOpts = new ArrayList<String>();

        // for a perfect match return the single option only
        if (longOpts.keySet().contains(opt))
        {
            return Collections.singletonList(opt);
        }

        for (String longOpt : longOpts.keySet())
        {
            if (longOpt.startsWith(opt))
            {
                matchingOpts.add(longOpt);
            }
        }
        
        return matchingOpts;
    }
915705
def choices
      extracted_choices = []

      unless self.qp_answers.nil?
        self.qp_answers.each do |choice|   
          extracted_choices.push(Choice.new(choice))
        end           
      end

      return extracted_choices        
    end
1066459
def getAllValuesForFieldsAsJSON( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
     ret = getAllValuesForFieldsAsArray(dbid,fieldNames,query,qid,qname,clist,slist,fmt,options)
     ret = JSON.generate(ret) if ret
   end
232830
def export_values(values, options = nil)
      return if values.nil?
      values.map { |v| export_value(v, options) }
    end
1342730
def qvalue(media_type)
      return 1 if @qvalues.empty?
      m = matches(media_type)
      return 0 if m.empty?
      normalize_qvalue(@qvalues[m.first])
    end
121339
def qvalue(language)
      return 1 if @qvalues.empty?
      m = matches(language)
      return 0 if m.empty?
      normalize_qvalue(@qvalues[m.first])
    end
918920
def fetch_values(*keys, **options)
      return super if options.include?(:raw)
      new_expires = expires_at(options, nil)
      options = Utils.without(options, :expires)
      substituted = {}
      block = if block_given?
                lambda do |key|
                  substituted[key] = true
                  yield key
                end
              end

      with_updates(options) do |updates|
        keys.zip(@adapter.fetch_values(*keys, **options, &block)).map do |key, entry|
          next entry if substituted[key]
          entry = invalidate_entry(key, entry, new_expires) do |new_entry|
            updates[key] = new_entry
          end
          if entry.nil?
            value = if block_given?
                      yield key
                    end
          else
            value, _ = entry
          end
          value
        end
      end
    end