From b7c941066bfba23fbdf8a4d6b5bdeb66fc5893bb Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Thu, 1 Mar 2018 16:41:27 +0100 Subject: [PATCH] [library] Remove use of Prefix --- beat/backend/python/library.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/beat/backend/python/library.py b/beat/backend/python/library.py index 6cc40b6..3d062c9 100755 --- a/beat/backend/python/library.py +++ b/beat/backend/python/library.py @@ -44,7 +44,7 @@ class Storage(utils.CodeStorage): Parameters: - prefix (beat.backend.python.utils.Prefix): Establishes the prefix of + prefix (str): Establishes the prefix of your installation. name (str): The name of the library object in the format @@ -59,11 +59,7 @@ class Storage(utils.CodeStorage): self.username, self.name, self.version = name.split('/') self.fullname = name - - if isinstance(prefix, utils.Prefix): - self.prefix = prefix - else: - self.prefix = utils.Prefix(prefix) + self.prefix = prefix path = utils.hashed_or_simple(self.prefix, 'libraries', name, suffix='.json') path = path[:-5] @@ -83,8 +79,7 @@ class Library(object): Parameters: - prefix (beat.backend.python.utils.Prefix): Establishes the prefix of - your installation. + prefix (str): Establishes the prefix of your installation. name (str): The fully qualified algorithm name (e.g. ``user/algo/1``) @@ -357,8 +352,7 @@ class Library(object): Parameters: - prefix (beat.backend.python.utils.Prefix): Establishes the prefix of - your installation. + prefix (str): Establishes the prefix of your installation. Returns: @@ -378,12 +372,9 @@ class Library(object): if not self.valid: raise RuntimeError("library is not valid") - if isinstance(prefix, six.string_types): - prefix = utils.Prefix(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)) + if prefix == self.prefix: + raise RuntimeError("Cannot export library to the same prefix (" + "%s)" % (prefix)) for k in self.libraries.values(): k.export(prefix) -- GitLab