| 192 | raise AttributeError("No such option: %s" % attr) |
| 193 | |
| 194 | def __setattr__(self, attr, value): |
| 195 | # This is slightly tricky. We allow attributes to be set on the instance |
| 196 | # until we have an _options attribute. After that, assignment is sent to |
| 197 | # the update function, and will raise an error for unknown options. |
| 198 | opts = self.__dict__.get("_options") |
| 199 | if not opts: |
| 200 | super().__setattr__(attr, value) |
| 201 | else: |
| 202 | self.update(**{attr: value}) |
| 203 | |
| 204 | def keys(self): |
| 205 | return set(self._options.keys()) |