Skip to content
Snippets Groups Projects
Commit 64254e31 authored by Stefano Borini's avatar Stefano Borini
Browse files

Added new id for parameters

parent be214961
No related branches found
No related tags found
1 merge request!45Added support for MCO named parameters.
......@@ -25,6 +25,30 @@ def bundle_id(producer, identifier):
A unique identifier for the bundle. The producer has authority and
control over the uniqueness of this identifier.
Returns
-------
str: an identifier to be used in the bundle.
"""
return _string_id("bundle", producer, identifier)
def mco_parameter_id(producer, identifier):
return _string_id("mco_parameter", producer, identifier)
def _string_id(entity_namespace, producer, identifier):
"""Creates an id for a generic entity.
Parameters
----------
entity_namespace: str
A namespace for the entity we want to address (e.g. "bundle")
producer: str
the company or research institute unique identifier (e.g. "enthought")
identifier: str
A unique identifier for the bundle. The producer has authority and
control over the uniqueness of this identifier.
Returns
-------
str: an identifier to be used in the bundle.
......@@ -35,7 +59,7 @@ def bundle_id(producer, identifier):
" " not in entry and
len(entry) != 0)
if not all(map(is_valid, [producer, identifier])):
if not all(map(is_valid, [entity_namespace, producer, identifier])):
raise ValueError("Invalid parameters specified.")
return "force.bdss.bundles.{}.{}".format(producer, identifier)
return "force.bdss.{}.{}.{}".format(entity_namespace, producer, identifier)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment