Skip to content
Permalink
Browse files

Implement a deepcopy method in Storage()

  • Loading branch information...
cvaroqui committed Jul 16, 2019
1 parent 5755c6d commit 4a2fbc3f00e883d01cb4b1a9b2604c49bf58a1f2
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/storage.py
@@ -1,3 +1,5 @@
from copy import deepcopy

class Storage(dict):
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
@@ -6,4 +8,6 @@ class Storage(dict):
__repr__ = lambda self: '<Storage %s>' % dict.__repr__(self)
__getstate__ = lambda self: None
__copy__ = lambda self: Storage(self) # pylint: disable=undefined-variable
def __deepcopy__(self, memo=None):
return Storage(deepcopy(dict(self), memo=memo))

0 comments on commit 4a2fbc3

Please sign in to comment.
You can’t perform that action at this time.