|
|
|
@@ -99,7 +99,7 @@ class LearnwareClient: |
|
|
|
|
|
|
|
@require_login |
|
|
|
def upload_learnware(self, learnware_zip_path, semantic_specification): |
|
|
|
assert self._check_semantic_specification(semantic_specification) |
|
|
|
assert self._check_semantic_specification(semantic_specification), "Semantic specification check failed!" |
|
|
|
file_hash = compute_file_hash(learnware_zip_path) |
|
|
|
url_upload = f"{self.host}/user/chunked_upload" |
|
|
|
|
|
|
|
@@ -405,14 +405,14 @@ class LearnwareClient: |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def _check_semantic_specification(semantic_spec): |
|
|
|
return EasySemanticChecker.check_semantic_spec(semantic_spec) |
|
|
|
return EasySemanticChecker.check_semantic_spec(semantic_spec) != EasySemanticChecker.INVALID_LEARNWARE |
|
|
|
|
|
|
|
@staticmethod |
|
|
|
def check_learnware(learnware_zip_path, semantic_specification=None): |
|
|
|
semantic_specification = ( |
|
|
|
get_semantic_specification() if semantic_specification is None else semantic_specification |
|
|
|
) |
|
|
|
LearnwareClient._check_semantic_specification(semantic_specification) |
|
|
|
assert LearnwareClient._check_semantic_specification(semantic_specification), "Semantic specification check failed!" |
|
|
|
|
|
|
|
with tempfile.TemporaryDirectory(prefix="learnware_") as tempdir: |
|
|
|
with zipfile.ZipFile(learnware_zip_path, mode="r") as z_file: |
|
|
|
|