コード例 #1
0
 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)
コード例 #2
0
ファイル: model.py プロジェクト: vishalbelsare/followthemoney
 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)