Makes a dictionary behave like an object, with attribute-style access.
| 70 | |
| 71 | |
| 72 | class ObjectDict(Dict[str, Any]): |
| 73 | """Makes a dictionary behave like an object, with attribute-style access.""" |
| 74 | |
| 75 | def __getattr__(self, name: str) -> Any: |
| 76 | try: |
| 77 | return self[name] |
| 78 | except KeyError: |
| 79 | raise AttributeError(name) |
| 80 | |
| 81 | def __setattr__(self, name: str, value: Any) -> None: |
| 82 | self[name] = value |
| 83 | |
| 84 | |
| 85 | class GzipDecompressor(object): |
no outgoing calls