Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
fe3a98ff
Commit
fe3a98ff
authored
1 year ago
by
Wouter Deconinck
Committed by
MarkusFrankATcernch
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: accept list of str as action argument
parent
fd757899
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDG4/python/DDSim/Helper/Action.py
+9
-2
9 additions, 2 deletions
DDG4/python/DDSim/Helper/Action.py
with
9 additions
and
2 deletions
DDG4/python/DDSim/Helper/Action.py
+
9
−
2
View file @
fe3a98ff
...
@@ -160,8 +160,15 @@ or
...
@@ -160,8 +160,15 @@ or
# creates: [ {
"
name
"
:
"
Geant4TestEventAction
"
,
"
parameter
"
: {
"
Property_int
"
: 10} } ]
# creates: [ {
"
name
"
:
"
Geant4TestEventAction
"
,
"
parameter
"
: {
"
Property_int
"
: 10} } ]
val = [val]
val = [val]
if isinstance(val, list):
if isinstance(val, list):
# assumes: [ {
"
name
"
:
"
Geant4TestEventAction
"
,
"
parameter
"
: {
"
Property_int
"
: 10} } ]
if not val:
return val
# empty list
return []
if isinstance(val[0], str):
# assumes: [
"
Geant4TestEventAction
"
,
"
Geant4TestEventAction
"
]
return [dict(name=v) for v in val]
if isinstance(val[0], dict):
# assumes: [ {
"
name
"
:
"
Geant4TestEventAction
"
,
"
parameter
"
: {
"
Property_int
"
: 10} } ]
return val
raise RuntimeError(
"
Commandline setting of action is not successful for: %s
"
% val)
raise RuntimeError(
"
Commandline setting of action is not successful for: %s
"
% val)
@property
@property
...
...
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