def _load(self, filepath): with open(filepath, 'r') as fh: data = yaml.safe_load(fh) if not isinstance(data, dict): raise InvalidModel('Model file is not a mapping.') for name, config in data.items(): self.schemata[name] = Schema(self, name, config)
def _load(self, filepath: str) -> None: with open(filepath, "r", encoding="utf-8") as fh: data = yaml.safe_load(fh) if not isinstance(data, dict): raise InvalidModel("Model file is not a mapping: %s" % filepath) for name, config in data.items(): self.schemata[name] = Schema(self, name, config)