pg.patch_on_path¶
Accessible via pg.patch_on_path
, pg.patching.patch_on_path
.
- patch_on_path(src, regex, value=None, value_fn=None, skip_notification=None)[source]¶
Recursively patch values on matched paths.
Example:
d = pg.Dict(a={'x': 1}, b=2) print(pg.patching.patch_on_path(d, '.*x', value=3)) # {a={x=1}, b=2}
- Return type:
- Parameters:
src – symbolic value to patch.
regex – Regex for key path.
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.