Ejemplo n.º 1
0
	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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
	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
Ejemplo n.º 7
0
	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))
Ejemplo n.º 8
0
	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