Skip to content
Snippets Groups Projects
Commit b7c94106 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[library] Remove use of Prefix

parent 01184a7f
Branches
Tags
1 merge request!17Merge development branch 1.5.x
...@@ -44,7 +44,7 @@ class Storage(utils.CodeStorage): ...@@ -44,7 +44,7 @@ class Storage(utils.CodeStorage):
Parameters: Parameters:
prefix (beat.backend.python.utils.Prefix): Establishes the prefix of prefix (str): Establishes the prefix of
your installation. your installation.
name (str): The name of the library object in the format name (str): The name of the library object in the format
...@@ -59,11 +59,7 @@ class Storage(utils.CodeStorage): ...@@ -59,11 +59,7 @@ class Storage(utils.CodeStorage):
self.username, self.name, self.version = name.split('/') self.username, self.name, self.version = name.split('/')
self.fullname = name self.fullname = name
self.prefix = prefix
if isinstance(prefix, utils.Prefix):
self.prefix = prefix
else:
self.prefix = utils.Prefix(prefix)
path = utils.hashed_or_simple(self.prefix, 'libraries', name, suffix='.json') path = utils.hashed_or_simple(self.prefix, 'libraries', name, suffix='.json')
path = path[:-5] path = path[:-5]
...@@ -83,8 +79,7 @@ class Library(object): ...@@ -83,8 +79,7 @@ class Library(object):
Parameters: Parameters:
prefix (beat.backend.python.utils.Prefix): Establishes the prefix of prefix (str): Establishes the prefix of your installation.
your installation.
name (str): The fully qualified algorithm name (e.g. ``user/algo/1``) name (str): The fully qualified algorithm name (e.g. ``user/algo/1``)
...@@ -357,8 +352,7 @@ class Library(object): ...@@ -357,8 +352,7 @@ class Library(object):
Parameters: Parameters:
prefix (beat.backend.python.utils.Prefix): Establishes the prefix of prefix (str): Establishes the prefix of your installation.
your installation.
Returns: Returns:
...@@ -378,12 +372,9 @@ class Library(object): ...@@ -378,12 +372,9 @@ class Library(object):
if not self.valid: if not self.valid:
raise RuntimeError("library is not valid") raise RuntimeError("library is not valid")
if isinstance(prefix, six.string_types): if prefix == self.prefix:
prefix = utils.Prefix(prefix) raise RuntimeError("Cannot export library to the same prefix ("
"%s)" % (prefix))
if prefix.paths[0] in self.prefix.paths:
raise RuntimeError("Cannot export library to the same prefix (%s in " \
"%s)" % (prefix.paths[0], self.prefix.paths))
for k in self.libraries.values(): for k in self.libraries.values():
k.export(prefix) k.export(prefix)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment