Example #1
0
 def load(self, filename: str) -> Any:
     full_path = os.path.join(self.root_path, filename)
     content = load_json(full_path)
     for profile in self.profiles:
         try:
             profile_content = load_json(profile_path(profile, full_path))
             content = _update(content, profile_content)
         except:
             pass
     return content
Example #2
0
 def transform(self, path: str) -> str:
     if self == ResultType.json:
         return load_json(path)
     if self == ResultType.file:
         with open(path, 'r') as f:
             return f.read()
     if self == ResultType.image:
         return path
Example #3
0
    def conf_validation(self) -> None:
        PESTO_LOG.info('********** validate requirements.json **********')
        requirements_schema = load_json(Builder.SCHEMA_PATH,
                                        'requirements_schema.json')
        validate_json(self.configs[PestoFiles.requirements],
                      requirements_schema)

        PESTO_LOG.info('********** validate config.json **********')
        validate_json(self.configs[PestoFiles.config],
                      self.configs[PestoFiles.config_schema])
Example #4
0
    def from_path(path: str,
                  profiles: List[str] = None,
                  proxy: str = None,
                  pip_extra_index: str = None):
        assert path is not None

        build_config = load_json(path)
        return BuildConfig(name=build_config['name'],
                           version=build_config['version'],
                           profiles=profiles,
                           workspace=build_config.get('workspace'),
                           algorithm_path=build_config.get('algorithm_path')
                           or str(Path(path).parent.parent.parent),
                           proxy=proxy,
                           pip_extra_index=pip_extra_index)
Example #5
0
 def compute_version() -> Any:
     return load_json(DescribeService.VERSION_CONTENT_PATH)
Example #6
0
 def __init__(self, url_root: str):
     self.description = load_json(DescribeService.SERVICE_JSON_PATH)
     self.url_root = url_root