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
c388b410
Commit
c388b410
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation for the find methods
parent
8e7a6e26
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Extracts registry from application plugin.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
force_bdss/bundle_registry_plugin.py
+46
-6
46 additions, 6 deletions
force_bdss/bundle_registry_plugin.py
with
46 additions
and
6 deletions
force_bdss/bundle_registry_plugin.py
+
46
−
6
View file @
c388b410
...
...
@@ -42,26 +42,66 @@ class BundleRegistryPlugin(Plugin):
id
=
'
force.bdss.kpi_calculators.bundles
'
)
def
data_source_bundle_by_id
(
self
,
id
):
"""
Finds a given data source bundle by means of its id.
The ID is as obtained by the function bundle_id() in the
plugin api.
Parameters
----------
id: str
The identifier returned by the bundle_id() function.
Raises
------
ValueError: if the entry is not found.
"""
for
ds
in
self
.
data_source_bundles
:
if
ds
.
id
==
id
:
return
ds
raise
Exception
(
"
Requested data source {} but don
'
t know
"
"
to find it.
"
.
format
(
id
))
raise
ValueError
(
"
Requested data source {} but don
'
t know how
"
"
to find it.
"
.
format
(
id
))
def
kpi_calculator_bundle_by_id
(
self
,
id
):
"""
Finds a given kpi bundle by means of its id.
The ID is as obtained by the function bundle_id() in the
plugin api.
Parameters
----------
id: str
The identifier returned by the bundle_id() function.
Raises
------
ValueError: if the entry is not found.
"""
for
kpic
in
self
.
kpi_calculator_bundles
:
if
kpic
.
id
==
id
:
return
kpic
raise
Exception
(
"
Requested kpi calculator {} but don
'
t know
"
raise
ValueError
(
"
Requested kpi calculator {} but don
'
t know
how
"
"
to find it.
"
.
format
(
id
))
def
mco_bundle_by_id
(
self
,
id
):
"""
Finds a given Multi Criteria Optimizer (MCO) bundle by means of
its id. The ID is as obtained by the function bundle_id() in the
plugin api.
Parameters
----------
id: str
The identifier returned by the bundle_id() function.
Raises
------
ValueError: if the entry is not found.
"""
for
mco
in
self
.
mco_bundles
:
if
mco
.
id
==
id
:
return
mco
raise
Exception
(
"
Requested MCO {} but
it
'
s not available
"
"
to
compute
it.
"
.
format
(
id
))
raise
ValueError
(
"
Requested MCO {} but
don
'
t know how
"
"
to
find
it.
"
.
format
(
id
))
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