Exemplo n.º 1
0
    def _load_reader(reader_info):
        """Import and setup the reader from *reader_info*
        """
        try:
            loader = runtime_import(reader_info["reader"])
        except ImportError as err:
            raise ImportError(
                "Could not import reader class '{}' for reader '{}': {}".
                format(reader_info["reader"], reader_info["name"], str(err)))
        reader_instance = loader(reader_info['config_files'])

        return reader_instance
Exemplo n.º 2
0
    def _load_reader(reader_info):
        """Import and setup the reader from *reader_info*
        """
        try:
            loader = runtime_import(reader_info["reader"])
        except ImportError as err:
            raise ImportError(
                "Could not import reader class '{}' for reader '{}': {}".format(
                    reader_info["reader"], reader_info["name"], str(err)))
        reader_instance = loader(reader_info['config_files'])

        return reader_instance
Exemplo n.º 3
0
    def load_writer_config(self, config_files, **kwargs):
        conf = configparser.RawConfigParser()
        successes = conf.read(config_files)
        if not successes:
            raise IOError("Writer configuration files do not exist: %s" %
                          (config_files, ))

        for section_name in conf.sections():
            if section_name.startswith("writer:"):
                options = dict(conf.items(section_name))
                writer_class_name = options["writer"]
                writer_class = runtime_import(writer_class_name)
                writer = writer_class(ppp_config_dir=self.ppp_config_dir,
                                      config_files=config_files,
                                      **kwargs)
                return writer
Exemplo n.º 4
0
    def load_writer_config(self, config_files, **kwargs):
        conf = configparser.RawConfigParser()
        successes = conf.read(config_files)
        if not successes:
            raise IOError("Writer configuration files do not exist: %s" %
                          (config_files, ))

        for section_name in conf.sections():
            if section_name.startswith("writer:"):
                options = dict(conf.items(section_name))
                writer_class_name = options["writer"]
                writer_class = runtime_import(writer_class_name)
                writer = writer_class(ppp_config_dir=self.ppp_config_dir,
                                      config_files=config_files,
                                      **kwargs)
                return writer