def _read_file(cls, path: Text) -> Dict: ext = os.path.splitext(path)[-1].lower().lstrip('.') if ext in ('yaml', 'yml'): return cls._expand_vars(Yaml.read(path) or {}) elif ext == 'json': return cls._expand_vars(Json.read(path) or {}) else: raise UnrecognizedManifestFileFormat( f'only json and yaml manifest files are ' f'supported: {path}')
def load_static_context(self) -> Dict: path = os.path.join(self.path, 'context.yml') if os.path.exists(path): return Yaml.read(path) or {} path = os.path.join(self.path, 'context.json') if os.path.exists(path): return Json.read(path) or {} raise ValueError(f'cannot find context file')
def read(self, abs_path: Text) -> dict: return Json.read(abs_path)