| 12 | |
| 13 | |
| 14 | class ContextDict(dict): |
| 15 | def __init__(self, context, *args, **kwargs): |
| 16 | super().__init__(*args, **kwargs) |
| 17 | |
| 18 | context.dicts.append(self) |
| 19 | self.context = context |
| 20 | |
| 21 | def __enter__(self): |
| 22 | return self |
| 23 | |
| 24 | def __exit__(self, *args, **kwargs): |
| 25 | self.context.pop() |
| 26 | |
| 27 | |
| 28 | class BaseContext: |