Extract options from a dictionary against the template
328474
def extract_options_dict(template, options):
    """"""
    for option, val in template.items():
        if options and option in options:
            yield option, options[option]
        else:
            yield option, Default(template[option]['default'](os.environ))
710138
def get(self):
        """"""
        return {k:v for k,v in list(self.options.items()) if k in self._allowed_layout}
26019
def _extract_constants(self, specification):
        
        constants = {}

        for attribute in specification.attributes:

            if attribute.allowed_choices and len(attribute.allowed_choices) > 0:

                name = attribute.local_name.upper()

                for choice in attribute.allowed_choices:
                    constants["CONST_%s_%s" % (name, choice.upper())] = choice

        return constants
590181
def extract_options(names)
      options = {}
      options = names.pop if names.last.kind_of? Hash
      options = { :desc => @next_desc, 
                  :long_desc => @next_long_desc,
                  :default_value => @next_default_value,
                  :arg_name => @next_arg_name}.merge(options)
    end
171557
def get_context(self, name, value, attrs):
        """"""
        context = {}
        context['widget'] = {
            'name': name,
            'type': 'text',
            'is_hidden': self.is_hidden,
            'required': self.is_required,
            'value': self.format_value(value),
            'attrs': {**self.attrs, **(attrs or {})},
            'template_name': self.template_name,
        }
        return context
1029756
def list2dict(list_of_options):
    """"""
    d = {}
    for key, value in list_of_options:
        d[key] = value
    return d
105571
def options(self):
        
        keys = self.__class__.__dict__.copy()
        keys.update(self.__dict__)
        keys = sorted(keys.keys())

        for opt in keys:
            val = self.get(opt)
            if val is not None:
                yield opt, val
837368
def parse_options(cls, options):
    """"""
    cls.ignore_decorators = options.ignore_decorators
    cls.exclude_from_doctest = options.exclude_from_doctest
    if not isinstance(cls.exclude_from_doctest, list):
      cls.exclude_from_doctest = [cls.exclude_from_doctest]
188956
def extract_props(self, settings):
        '''
        
        '''

        props = {}

        for param in self.call_parameters:
            if param in settings:
                props[param] = settings[param]
            else:
                props[param] = None

        return props
180104
def _options(self, **kwargs):
        
        def _format_fq(d):
            for k,v in d.items():
                if isinstance(v, list):
                    d[k] = ' '.join(map(lambda x: '"' + x + '"', v))
                else:
                    d[k] = '"' + v + '"'
            values = []
            for k,v in d.items():
                value = '%s:(%s)' % (k,v)
                values.append(value)
            values = ' AND '.join(values)
            return values
        
        kwargs = self._utf8_encode(kwargs)
        kwargs = self._bool_encode(kwargs)
        
        values = ''
        
        for k, v in kwargs.items():
            if k is 'fq' and isinstance(v, dict):
                v = _format_fq(v)
            elif isinstance(v, list):
                v = ','.join(v)
            values += '%s=%s&' % (k, v)
        
        return values
809778
def parse_options():
    

    try:
        opts, args = getopt.getopt(sys.argv[1:], 'ac:e:hilms:t:vx',
                ['adapt', 'comp=', 'enum=', 'exhaust', 'help', 'incr', 'blo',
                    'minimize', 'solver=', 'trim=', 'verbose'])
    except getopt.GetoptError as err:
        sys.stderr.write(str(err).capitalize())
        usage()
        sys.exit(1)

    adapt = False
    exhaust = False
    cmode = None
    to_enum = 1
    incr = False
    blo = False
    minz = False
    solver = 'g3'
    trim = 0
    verbose = 1

    for opt, arg in opts:
        if opt in ('-a', '--adapt'):
            adapt = True
        elif opt in ('-c', '--comp'):
            cmode = str(arg)
        elif opt in ('-e', '--enum'):
            to_enum = str(arg)
            if to_enum != 'all':
                to_enum = int(to_enum)
            else:
                to_enum = 0
        elif opt in ('-h', '--help'):
            usage()
            sys.exit(0)
        elif opt in ('-i', '--incr'):
            incr = True
        elif opt in ('-l', '--blo'):
            blo = True
        elif opt in ('-m', '--minimize'):
            minz = True
        elif opt in ('-s', '--solver'):
            solver = str(arg)
        elif opt in ('-t', '--trim'):
            trim = int(arg)
        elif opt in ('-v', '--verbose'):
            verbose += 1
        elif opt in ('-x', '--exhaust'):
            exhaust = True
        else:
            assert False, 'Unhandled option: {0} {1}'.format(opt, arg)

    return adapt, blo, cmode, to_enum, exhaust, incr, minz, solver, trim, \
            verbose, args
1149532
function(expr, options) {
                    var ctx = expr;
                    expr = Mustache.resolve(expr);
                    if ( !! expr) {
                        return options.fn(ctx);
                    }
                }
956889
def extract_values(self, possible_solution, use_defaults=False):
        
        defaults = self._vardefaults if use_defaults else {}
        values = list(self._template)
        for i, var in enumerate(self._vars):
            values[i] = possible_solution.get(var, defaults.get(var, NilObject()))
        return values
1235325
def template_to_dict_alt(tree, title):
    
    box = []
    part = []

    for item in tree.iter():

        if item.tag == 'part':
            if part:
                box.append(part)
            part = []

        if item.tag == 'name' or item.tag == 'value':
            for attr in item.keys():
                part.append({attr: item.get(attr)})

            if item.text:
                part.append(item.text.strip())

            if item.tail:
                part.append(item.tail.strip())

    if part:
        box.append(part)

    return {title.strip(): box}
203260
def value(self, view, template=None):
        
        out = AttrDict()
        for key, typ in self.subtemplates.items():
            out[key] = typ.value(view[key], self)
        return out
775835
private static int extractOptions(String pattern, int i, List options) {
    while ((i < pattern.length()) && (pattern.charAt(i) == '{')) {
      int end = pattern.indexOf('}', i);

      if (end == -1) {
        break;
      }

      String r = pattern.substring(i + 1, end);
      options.add(r);
      i = end + 1;
    }

    return i;
  }
172785
def substitute(self, values: Dict[str, Any]) -> str:
        
        return self.template.substitute(values)