def get_dict(self, option, default=unspecified, parser=identity, strfun=str, **kwargs): # Returns a tuple with (<dictionary>, <keys>) - the keys are sorted by order of appearance # Default key is accessed via key == None (None is never in keys!) return self._get_internal('dictionary', obj2str=lambda value: str_dict_cfg(value, parser, strfun), str2obj=lambda value: parse_dict_cfg(value, parser), def2obj=lambda value: (value, sorted(ifilter(lambda key: key is not None, value.keys()))), option=option, default_obj=default, **kwargs)
def get_dict(self, option, default=unspecified, parser=identity, strfun=str, **kwargs): # Returns a tuple with (<dictionary>, <keys>) - the keys are sorted by order of appearance # Default key is accessed via key == None (None is never in keys!) return self._get_internal( 'dictionary', obj2str=lambda value: str_dict_cfg(value, parser, strfun), str2obj=lambda value: parse_dict_cfg(value, parser), def2obj=lambda value: (value, sorted(ifilter(lambda key: key is not None, value.keys())) ), option=option, default_obj=default, **kwargs)
def parse_value(self, pconfig, varexpr, output_vn, value): source = pconfig.get(varexpr, 'source') default = pconfig.get(varexpr, 'default', '') setup_dict = parse_dict_cfg(value) return ('RegexTransformParameterSource', output_vn, source, setup_dict[0], setup_dict[1], default) # class init tuple
def _parse_dict(self, vn, dict_str, value_parser): keytuple_delimeter = self.get(self._get_varexpr(vn), 'key delimeter', ',') return parse_dict_cfg(dict_str, value_parser, lambda k: parse_tuple(k, keytuple_delimeter))
def parse_value(self, pconfig, varexpr, vn, value): default = pconfig.get(varexpr, 'default', '') setup_dict = parse_dict_cfg(pconfig.get(varexpr, 'transform', '')) return ('RegexTransformParameterSource', vn, value, setup_dict[0], setup_dict[1], default) # class init tuple