Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alex Pearce
Gaudi
Commits
c42d2077
Commit
c42d2077
authored
Jun 25, 2021
by
Alex Pearce
🌈
Browse files
Extend GaudiConfig2 configurable to match Configurables API.
parent
46f979b2
Pipeline
#2759505
failed with stages
in 53 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
GaudiConfiguration/python/GaudiConfig2/_configurables.py
View file @
c42d2077
...
...
@@ -237,9 +237,14 @@ class Configurable(ConfigMetaHelper):
def
is_property_set
(
self
,
propname
):
return
self
.
_descriptors
[
propname
].
__is_set__
(
self
,
type
(
self
))
def
getGaudiType
(
self
):
@
classmethod
def
getGaudiType
(
cls
):
return
self
.
__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 @
c42d2077
...
...
@@ -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
Markdown
is supported
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