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)
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)
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)
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)
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)