예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)