Exemple #1
0
 def __call__(self, value, loader_context=None):
     if loader_context:
         context = MergeDict(loader_context, self.default_loader_context)
     else:
         context = self.default_loader_context
     wrapped_funcs = [wrap_loader_context(f, context) for f in self.functions]
     for func in wrapped_funcs:
         if value is None and self.stop_on_none:
             break
         value = func(value)
     return value
Exemple #2
0
 def __call__(self, value, loader_context=None):
     values = arg_to_iter(value)
     if loader_context:
         context = MergeDict(loader_context, self.default_loader_context)
     else:
         context = self.default_loader_context
     wrapped_funcs = [wrap_loader_context(f, context) for f in self.functions]
     for func in wrapped_funcs:
         next_values = []
         for v in values:
             next_values += arg_to_iter(func(v))
         values = next_values
     return values
    def __call__(self, value, loader_context=None):
        if loader_context:
            context = MergeDict(loader_context, self.default_loader_context)
        else:
            context = self.default_loader_context
        wrapped_funcs = [
            wrap_loader_context(f, context) for f in self.functions
        ]

        results = []

        for func in wrapped_funcs:
            #if value is None and self.stop_on_none:
            #    break
            results.append(func(value))

        return list(itertools.chain(*results))
Exemple #4
0
 def __call__(self, value, loader_context=None):
     if loader_context:
         context = MergeDict(loader_context, self.default_loader_context)
     else:
         context = self.default_loader_context
     wrapped_funcs = [
         wrap_loader_context(f, context) for f in self.functions
     ]
     for func in wrapped_funcs:
         if value is None and self.stop_on_none:
             break
         try:
             value = func(value)
         except Exception as e:
             raise ValueError("Error in Compose with "
                              "%s value=%r error='%s: %s'" %
                              (str(func), value, type(e).__name__, str(e)))
     return value
Exemple #5
0
 def __call__(self, value, loader_context=None):
     values = arg_to_iter(value)
     if loader_context:
         context = MergeDict(loader_context, self.default_loader_context)
     else:
         context = self.default_loader_context
     wrapped_funcs = [
         wrap_loader_context(f, context) for f in self.functions
     ]
     for func in wrapped_funcs:
         next_values = []
         for v in values:
             try:
                 next_values += arg_to_iter(func(v))
             except Exception as e:
                 raise ValueError(
                     "Error in MapCompose with "
                     "%s value=%r error='%s: %s'" %
                     (str(func), value, type(e).__name__, str(e)))
         values = next_values
     return values