Add dotdict._to_dict.

master
voussoir 2022-11-07 17:57:40 -08:00
parent 7618c46226
commit 73e8b48003
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 5 additions and 2 deletions

View File

@ -28,10 +28,13 @@ class DotDict:
def __setattr__(self, key, value): def __setattr__(self, key, value):
self.__dict__[key] = value self.__dict__[key] = value
def __iter__(self): def _to_dict(self):
display = self.__dict__.copy() display = self.__dict__.copy()
display.pop('_DotDict__default') display.pop('_DotDict__default')
return iter(display.items()) return display
def __iter__(self):
return iter(self._to_dict().items())
def __repr__(self): def __repr__(self):
display = self.__dict__.copy() display = self.__dict__.copy()