cogwheel.utils.temporarily_change_attributes¶
- cogwheel.utils.temporarily_change_attributes(obj, /, **kwargs)¶
Change attributes of an object temporarily in a context manager.
Examples
>>> class A: ... x = 0 >>> a = A() >>> a.x 0 >>> with temporarily_change_attributes(a, x=1): ... print(a.x) 1 >>> a.x 0