(self, func)
| 1419 | |
| 1420 | |
| 1421 | def decorate_callable(self, func): |
| 1422 | # NB. Keep the method in sync with decorate_async_callable() |
| 1423 | if hasattr(func, 'patchings'): |
| 1424 | func.patchings.append(self) |
| 1425 | return func |
| 1426 | |
| 1427 | @wraps(func) |
| 1428 | def patched(*args, **keywargs): |
| 1429 | with self.decoration_helper(patched, |
| 1430 | args, |
| 1431 | keywargs) as (newargs, newkeywargs): |
| 1432 | return func(*newargs, **newkeywargs) |
| 1433 | |
| 1434 | patched.patchings = [self] |
| 1435 | return patched |
| 1436 | |
| 1437 | |
| 1438 | def decorate_async_callable(self, func): |