-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Handle setting module parameters from a dict or PSet #46067
Conversation
Properly handle passing multiple dicts to a Parameterizeable Added update_ method similar to dict.update
When using new syntax to create a module, can now pass a PSet or dict in the same way as one could using the old syntax.
please test |
cms-bot internal usage |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46067/41857 |
A new Pull Request was created by @Dr15Jones for master. It involves the following packages:
@Dr15Jones, @makortel, @smuzaffar can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
-1 Failed Tests: UnitTests RelVals-INPUT The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic: You can see more details here: Unit TestsI found 1 errors in the following unit tests: ---> test test-das-selected-lumis had ERRORS RelVals-INPUT
Expand to see more relval errors ...
Comparison SummarySummary:
|
The failures were all DAS which is unrelated to this PR |
please test let's see if we can get a clean check. |
+1 Size: This PR adds an extra 32KB to repository Comparison SummarySummary:
|
Comparison differences are related to #39803 |
FWCore/ParameterSet/python/Mixins.py
Outdated
if isinstance(d,dict): | ||
for k,v in d.items(): | ||
setattr(self, k, v) | ||
else: | ||
for k,v in d.parameters_().items(): | ||
setattr(self,k,v) |
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.
How about
if isinstance(d,dict): | |
for k,v in d.items(): | |
setattr(self, k, v) | |
else: | |
for k,v in d.parameters_().items(): | |
setattr(self,k,v) | |
items = d.items() if isinstance(d, dict) else d.parameters_().items() | |
for k,v in items: | |
setattr(self, k, v) |
?
a.update_(dict(a=3)) | ||
self.assertEqual(a.a.value(), 3) | ||
a.update_(__PSet(a=__TestType(5))) | ||
self.assertEqual(a.a.value(), 5) |
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.
Could you add a test case also for
a.update_(dict(c=6))
? I'd expect it to raise an exception.
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46067/41893 |
Pull request #46067 was updated. @Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please check and sign again. |
please test |
+1 Size: This PR adds an extra 24KB to repository Comparison SummarySummary:
|
Comparison differences continue to be related to #39803 |
+core |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @rappoccio, @sextonkennedy, @mandrenguyen, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
PR validation:
Code compiles. New unit tests pass. Ran the new initialization syntax using a PSet by hand and it worked.