nteract / vdom

🎄 Virtual DOM for Python
https://github.com/nteract/vdom/blob/master/docs/mimetype-spec.md
BSD 3-Clause "New" or "Revised" License
221 stars 34 forks source link

FrozenDict breaks Exploring Elements notebook #111

Open rgbkrk opened 1 year ago

rgbkrk commented 1 year ago

The following code breaks in the example notebook titled "Exploring Elements"

attrs = vid.attributes.copy()
attrs['controls'] = False
attrs['autoplay'] = False
hand.update(video(vid.children, **attrs))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[6], line 1
----> 1 attrs = vid.attributes.copy()
      2 attrs['controls'] = False
      3 attrs['autoplay'] = False

File ~/code/src/github.com/nteract/vdom/vdom/frozendict.py:28, in FrozenDict.__setitem__(self, *args, **kwargs)
     27 def __setitem__(self, *args, **kwargs):
---> 28     return self.__readonly__(super(FrozenDict, self).__setitem__, *args, **kwargs)

File ~/code/src/github.com/nteract/vdom/vdom/frozendict.py:23, in FrozenDict.__readonly__(self, func, *args, **kwargs)
     21 def __readonly__(self, func, *args, **kwargs):
     22     if self.frozen:
---> 23         raise ValueError("Can not modify FrozenDict")
     24     else:
     25         return func(*args, **kwargs)

ValueError: Can not modify FrozenDict