Applies the function `func` to all attributes.
(self, func)
| 62 | self._handler_dict = {} |
| 63 | |
| 64 | def apply(self, func): |
| 65 | """Applies the function `func` to all attributes. |
| 66 | """ |
| 67 | for k, v in self.__dict__.items(): |
| 68 | if v is not None and k[:2] != '__' and k[-2:] != '__': |
| 69 | self.__dict__[k] = func(v) |
| 70 | return self |
| 71 | |
| 72 | def __getitem__(self, key): |
| 73 | return getattr(self, key, None) |