pg.patch_on_value¶
Accessible via pg.patch_on_value
, pg.patching.patch_on_value
.
- patch_on_value(src, old_value, value=None, value_fn=None, skip_notification=None)[source]¶
Recursively patch values on matched values.
Example:
d = pg.Dict(a={'x': 1}, b=1) print(pg.patching.patch_on_value(d, 1, value=3)) # {a={x=3}, b=3}
- Return type:
- Parameters:
src – symbolic value to patch.
old_value – Old value to match.
value – New value for field that satisfy condition.
value_fn – Callable object that produces new value based on old value. If not None, value must be None.
skip_notification – If True, on_change event will not be triggered for this operation. If None, the behavior is decided by pg.notify_on_rebind. Please see symbolic.Symbolic.rebind for details.
- Returns:
src after being patched.