-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make GenericParameters return optional instead of empty defaults on non-existant keys #580
Changes from all commits
4725084
cd5017d
e91faa0
c19d01c
541bd00
19a3c5a
d08f436
ad75657
170e242
eeadbf7
c0d5907
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#!/usr/bin/env python3 | ||
"""Module for the python bindings of the podio::Frame""" | ||
|
||
from copy import deepcopy | ||
|
||
import cppyy | ||
|
||
import ROOT | ||
|
@@ -190,10 +192,12 @@ def get_parameter(self, name, as_type=None): | |
""" | ||
|
||
def _get_param_value(par_type, name): | ||
par_value = self._frame.getParameter[par_type](name) | ||
# We can safely assume that getting the value here works, because | ||
# only valid keys will end up here | ||
par_value = self._frame.getParameter[par_type](name).value() | ||
if len(par_value) == 1: | ||
return par_value[0] | ||
return list(par_value) | ||
return list(deepcopy(par_value)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? Do the values disappear if the frame is deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They will definitely disappear if the Frame is gone. but in this case I think it's also something related to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be interaction between
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the problem is that the |
||
|
||
# This access already raises the KeyError if there is no such parameter | ||
par_type = self._param_key_types[name] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the last version before 1.0 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D I would hope so. However, the main reason for this is that setting this to
99
would in principle allow us to still have patch releases, while still having pre-processor checks only compare>0.99
effectively.In principle we could consider doing this by default after tagging a release to make it easier to detect development builds.