Update the signature of func with the data in self
(self, func, **kw)
| 153 | raise TypeError('You are decorating a non function: %s' % func) |
| 154 | |
| 155 | def update(self, func, **kw): |
| 156 | "Update the signature of func with the data in self" |
| 157 | func.__name__ = self.name |
| 158 | func.__doc__ = getattr(self, 'doc', None) |
| 159 | func.__dict__ = getattr(self, 'dict', {}) |
| 160 | func.__defaults__ = getattr(self, 'defaults', ()) |
| 161 | func.__kwdefaults__ = getattr(self, 'kwonlydefaults', None) |
| 162 | func.__annotations__ = getattr(self, 'annotations', None) |
| 163 | try: |
| 164 | frame = sys._getframe(3) |
| 165 | except AttributeError: # for IronPython and similar implementations |
| 166 | callermodule = '?' |
| 167 | else: |
| 168 | callermodule = frame.f_globals.get('__name__', '?') |
| 169 | func.__module__ = getattr(self, 'module', callermodule) |
| 170 | func.__dict__.update(kw) |
| 171 | |
| 172 | def make(self, src_templ, evaldict=None, addsource=False, **attrs): |
| 173 | "Make a new function from a given template and update the signature" |