matrix-gptbot/classes/dict.py
2023-05-02 06:58:49 +00:00

8 lines
No EOL
261 B
Python

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