Ejemplo n.º 1
0
    def from_yaml(cls, fname, *args, **kwargs):
        try:
            yaml_dict = yaml_load_file(fname,
                                       loader=kwargs.pop('loader', YAMLLoader))
        except IOError as e:
            logger.critical('No config file named: %s', fname)
            raise e

        tardis_config_version = yaml_dict.get('tardis_config_version', None)
        if tardis_config_version != 'v1.0':
            raise ConfigurationError(
                'Currently only tardis_config_version v1.0 supported')

        kwargs['config_dirname'] = os.path.dirname(fname)

        return cls.from_config_dict(yaml_dict, *args, **kwargs)
Ejemplo n.º 2
0
    def from_yaml(cls, fname, *args, **kwargs):
        try:
            yaml_dict = yaml_load_file(fname,
                                       loader=kwargs.pop("loader", YAMLLoader))
        except IOError as e:
            logger.critical(f"No config file named: {fname}")
            raise e

        tardis_config_version = yaml_dict.get("tardis_config_version", None)
        if tardis_config_version != "v1.0":
            raise ConfigurationError(
                "Currently only tardis_config_version v1.0 supported")

        kwargs["config_dirname"] = os.path.dirname(fname)

        return cls.from_config_dict(yaml_dict, *args, **kwargs)
Ejemplo n.º 3
0
    def from_yaml(cls, fname):
        """
        Read a configuration from a YAML file

        Parameters
        ----------
        fname : str
            filename or path
        """
        try:
            yaml_dict = yaml_load_file(fname)
        except IOError as e:
            logger.critical(f"No config file named: {fname}")
            raise e

        return cls.from_config_dict(yaml_dict)
Ejemplo n.º 4
0
    def from_yaml(cls, fname, *args, **kwargs):
        try:
            yaml_dict = yaml_load_file(fname,
                                       loader=kwargs.pop('loader', YAMLLoader))
        except IOError as e:
            logger.critical('No config file named: %s', fname)
            raise e

        tardis_config_version = yaml_dict.get('tardis_config_version', None)
        if tardis_config_version != 'v1.0':
            raise ConfigurationError(
                    'Currently only tardis_config_version v1.0 supported')

        kwargs['config_dirname'] = os.path.dirname(fname)

        return cls.from_config_dict(
            yaml_dict, *args, **kwargs)
Ejemplo n.º 5
0
    def from_yaml(cls, fname):
        """
        Read a configuration from a YAML file

        Parameters
        ----------

        fname: str
            filename or path
        """
        try:
            yaml_dict = yaml_load_file(fname)
        except IOError as e:
            logger.critical('No config file named: %s', fname)
            raise e


        return cls.from_config_dict(yaml_dict)