Skip to content

Commit

Permalink
Changes based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Sep 23, 2024
1 parent e49d999 commit 235fbea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions FWCore/ParameterSet/python/Mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,10 @@ def update_(self, d):
"""
if type(d).__name__ not in ["PSet", "__PSet", "dict"]:
raise ValueError("Only PSets or dicts can be passed to update_. This is a "+type(d).__name__)
if isinstance(d,dict):
for k,v in d.items():

items = d.items() if isinstance(d, dict) else d.parameters_().items()
for k,v in items:
setattr(self, k, v)
else:
for k,v in d.parameters_().items():
setattr(self,k,v)



Expand Down Expand Up @@ -865,6 +863,7 @@ def __init__(self,*arg,**args):
self.assertEqual(a.a.value(), 3)
a.update_(__PSet(a=__TestType(5)))
self.assertEqual(a.a.value(), 5)
self.assertRaises(TypeError, lambda: a.update_(dict(c=6)))

def testCopy(self):
class __Test(_TypedParameterizable):
Expand Down

0 comments on commit 235fbea

Please sign in to comment.