Elron commited on
Commit
a96c653
1 Parent(s): 88480b4

Upload catalog.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. catalog.py +5 -2
catalog.py CHANGED
@@ -6,7 +6,7 @@ import json
6
  from .artifact import Artifact, Artifactory
7
 
8
 
9
- COLLECTION_SEPARATOR = '::'
10
  PATHS_SEP = ':'
11
 
12
 
@@ -28,7 +28,10 @@ class LocalCatalog(Catalog):
28
  location: str = default_catalog_path
29
 
30
  def path(self, artifact_identifier: str):
31
- return os.path.join(self.location, *(artifact_identifier + ".json").split(COLLECTION_SEPARATOR))
 
 
 
32
 
33
  def load(self, artifact_identifier: str):
34
  assert artifact_identifier in self, "Artifact with name {} does not exist".format(artifact_identifier)
 
6
  from .artifact import Artifact, Artifactory
7
 
8
 
9
+ COLLECTION_SEPARATOR = '.'
10
  PATHS_SEP = ':'
11
 
12
 
 
28
  location: str = default_catalog_path
29
 
30
  def path(self, artifact_identifier: str):
31
+ assert artifact_identifier.strip(), 'artifact_identifier should not be an empty string.'
32
+ parts = artifact_identifier.split(COLLECTION_SEPARATOR)
33
+ parts[-1] = parts[-1] + ".json"
34
+ return os.path.join(self.location, *parts)
35
 
36
  def load(self, artifact_identifier: str):
37
  assert artifact_identifier in self, "Artifact with name {} does not exist".format(artifact_identifier)