matrix-gptbot/classes/dict.py

8 lines
261 B
Python
Raw Normal View History

class AttrDict(dict):
def __getattr__(self, key):
if key in self:
return self[key]
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{key}'")
def __setattr__(self, key, value):
self[key] = value