Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adham Hashibon
force-bdss
Commits
64254e31
Commit
64254e31
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Added new id for parameters
parent
be214961
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
Added support for MCO named parameters.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
force_bdss/ids.py
+26
-2
26 additions, 2 deletions
force_bdss/ids.py
with
26 additions
and
2 deletions
force_bdss/ids.py
+
26
−
2
View file @
64254e31
...
@@ -25,6 +25,30 @@ def bundle_id(producer, identifier):
...
@@ -25,6 +25,30 @@ def bundle_id(producer, identifier):
A unique identifier for the bundle. The producer has authority and
A unique identifier for the bundle. The producer has authority and
control over the uniqueness of this identifier.
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
Returns
-------
-------
str: an identifier to be used in the bundle.
str: an identifier to be used in the bundle.
...
@@ -35,7 +59,7 @@ def bundle_id(producer, identifier):
...
@@ -35,7 +59,7 @@ def bundle_id(producer, identifier):
"
"
not
in
entry
and
"
"
not
in
entry
and
len
(
entry
)
!=
0
)
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.
"
)
raise
ValueError
(
"
Invalid parameters specified.
"
)
return
"
force.bdss.
bundles
.{}.{}
"
.
format
(
producer
,
identifier
)
return
"
force.bdss.
{}
.{}.{}
"
.
format
(
entity_namespace
,
producer
,
identifier
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment