Fix DotDict instantiation when calling DD(some_dict).

This commit is contained in:
Ethan Dalool 2020-03-10 21:04:49 -07:00
parent 8245e31036
commit 0368bfe87c

View file

@ -8,8 +8,10 @@ from voussoirkit import sentinel
NO_DEFAULT = sentinel.Sentinel('NO_DEFAULT') NO_DEFAULT = sentinel.Sentinel('NO_DEFAULT')
class DotDict: class DotDict:
def __init__(self, default=NO_DEFAULT, **kwargs): def __init__(self, __dict=None, *, default=NO_DEFAULT, **kwargs):
self.__default = default self.__default = default
if __dict:
self.__dict__.update(__dict)
self.__dict__.update(**kwargs) self.__dict__.update(**kwargs)
def __getattr__(self, key): def __getattr__(self, key):