Convenience workaround of default 'attrs are config keys' behavior. Uses `object.__setattr__` to work around the class' normal proxying behavior, but is less verbose than using that directly. Has two modes (which may be combined if you really want): - ``se
(self, *args: Any, **kwargs: Any)
| 188 | return value |
| 189 | |
| 190 | def _set(self, *args: Any, **kwargs: Any) -> None: |
| 191 | """ |
| 192 | Convenience workaround of default 'attrs are config keys' behavior. |
| 193 | |
| 194 | Uses `object.__setattr__` to work around the class' normal proxying |
| 195 | behavior, but is less verbose than using that directly. |
| 196 | |
| 197 | Has two modes (which may be combined if you really want): |
| 198 | |
| 199 | - ``self._set('attrname', value)``, just like ``__setattr__`` |
| 200 | - ``self._set(attname=value)`` (i.e. kwargs), even less typing. |
| 201 | """ |
| 202 | if args: |
| 203 | object.__setattr__(self, *args) |
| 204 | for key, value in kwargs.items(): |
| 205 | object.__setattr__(self, key, value) |
| 206 | |
| 207 | def __repr__(self) -> str: |
| 208 | return "<{}: {}>".format(self.__class__.__name__, self._config) |
no test coverage detected