Beispiel #1
0
    def _load(self, name, context):
        impl = self.__plugins.get(name) or self.__plugins.get(name.lower())

        if impl:
            return get_class(impl).load(context)

        if name:
            for pbase in self.__plugin_base:
                try:
                    return get_class(name, pbase).load(context)
                except ImportError:
                    pass

        if not self.__load_python:
            return None

        cls = get_class(name)
        return lambda _, *args: cls(*args)  # Discard first context argument
  def _load(self, name, context):
    impl = self.__plugins.get(name) or self.__plugins.get(name.lower())

    if impl:
      return get_class(impl).load(context)

    if name:
      for pbase in self.__plugin_base:
        try:
          return get_class(name, pbase).load(context)
        except ImportError:
          pass

    if not self.__load_python:
      return None

    cls = get_class(name)
    return lambda _, *args: cls(*args)  # Discard first context argument
Beispiel #3
0
 def load(cls, params):
     return get_class(getattr(cls, field))(params)