MCPcopy Index your code
hub / github.com/prometheus/client_python / update

Method update

prometheus_client/decorator.py:155–170  ·  view source on GitHub ↗

Update the signature of func with the data in self

(self, func, **kw)

Source from the content-addressed store, hash-verified

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"

Callers 3

makeMethod · 0.95
__init__Method · 0.45
setup_testing_defaultsFunction · 0.45

Calls 1

getMethod · 0.45

Tested by 1

setup_testing_defaultsFunction · 0.36