Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alex Pearce
Gaudi
Commits
2915c617
Commit
2915c617
authored
Jun 25, 2021
by
Alex Pearce
Browse files
Extend GaudiConfig2 configurable to match Configurables API.
parent
46f979b2
Pipeline
#2760217
passed with stages
in 25 minutes and 39 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
GaudiConfiguration/python/GaudiConfig2/_configurables.py
View file @
2915c617
...
...
@@ -237,8 +237,13 @@ class Configurable(ConfigMetaHelper):
def
is_property_set
(
self
,
propname
):
return
self
.
_descriptors
[
propname
].
__is_set__
(
self
,
type
(
self
))
def
getGaudiType
(
self
):
return
self
.
__component_type__
@
classmethod
def
getGaudiType
(
cls
):
return
cls
.
__component_type__
@
classmethod
def
getType
(
cls
):
return
cls
.
__cpp_type__
def
getName
(
self
):
return
self
.
name
...
...
@@ -249,6 +254,14 @@ class Configurable(ConfigMetaHelper):
def
toStringProperty
(
self
):
return
"{}/{}"
.
format
(
self
.
__cpp_type__
,
self
.
name
)
@
classmethod
def
getDefaultProperties
(
cls
):
return
{
k
:
v
.
default
for
k
,
v
in
cls
.
_descriptors
.
items
()}
@
classmethod
def
getDefaultProperty
(
cls
,
name
):
return
cls
.
_descriptors
[
name
].
default
def
merge
(
self
,
other
):
'''
Merge the properties of the other instance into the current one.
...
...
GaudiConfiguration/tests/nose/test_configurable.py
View file @
2915c617
...
...
@@ -75,6 +75,14 @@ def test_configurable():
assert
a
.
toStringProperty
()
==
MyAlg
.
__cpp_type__
+
'/abc'
assert
MyAlg
.
getGaudiType
()
==
'Algorithm'
assert
MyAlg
.
getType
()
==
'TestConf::MyAlg'
assert
MyAlg
.
getDefaultProperty
(
"AStringProp"
)
==
'text'
assert
MyAlg
.
getDefaultProperties
()[
'ABoolProp'
]
==
False
def
test_properties
():
p
=
MyAlg
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment