(self, func)
| 1426 | |
| 1427 | |
| 1428 | def decorate_callable(self, func): |
| 1429 | # NB. Keep the method in sync with decorate_async_callable() |
| 1430 | if hasattr(func, 'patchings'): |
| 1431 | func.patchings.append(self) |
| 1432 | return func |
| 1433 | |
| 1434 | @wraps(func) |
| 1435 | def patched(*args, **keywargs): |
| 1436 | with self.decoration_helper(patched, |
| 1437 | args, |
| 1438 | keywargs) as (newargs, newkeywargs): |
| 1439 | return func(*newargs, **newkeywargs) |
| 1440 | |
| 1441 | patched.patchings = [self] |
| 1442 | return patched |
| 1443 | |
| 1444 | |
| 1445 | def decorate_async_callable(self, func): |