Browse Source

[FIX] fix bug in check_semantic_specification

tags/v0.3.2
Gene 2 years ago
parent
commit
fd4e7f8dbf
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      learnware/client/learnware_client.py

+ 3
- 3
learnware/client/learnware_client.py View File

@@ -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:


Loading…
Cancel
Save