Makes a dictionary behave like an object, with attribute-style access.
| 53 | |
| 54 | |
| 55 | class ObjectDict(Dict[str, Any]): |
| 56 | """Makes a dictionary behave like an object, with attribute-style access.""" |
| 57 | |
| 58 | def __getattr__(self, name: str) -> Any: |
| 59 | try: |
| 60 | return self[name] |
| 61 | except KeyError: |
| 62 | raise AttributeError(name) |
| 63 | |
| 64 | def __setattr__(self, name: str, value: Any) -> None: |
| 65 | self[name] = value |
| 66 | |
| 67 | |
| 68 | class GzipDecompressor: |
no outgoing calls