Fix DotDict instantiation when calling DD(some_dict).
This commit is contained in:
parent
8245e31036
commit
0368bfe87c
1 changed files with 3 additions and 1 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue