Rename collections to morecollections to avoid a conflict with the built in module.
This commit is contained in:
parent
64480fd4ed
commit
54fbb2a4c0
3 changed files with 2 additions and 2 deletions
12
util/morecollections.py
Normal file
12
util/morecollections.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
class AttrDict(dict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AttrDict, self).__init__(*args, **kwargs)
|
||||
self.__dict__ = self
|
||||
|
||||
@classmethod
|
||||
def deep_copy(cls, attr_dict):
|
||||
copy = AttrDict(attr_dict)
|
||||
for key, value in copy.items():
|
||||
if isinstance(value, AttrDict):
|
||||
copy[key] = cls.deep_copy(value)
|
||||
return copy
|
Reference in a new issue