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

Function _dispatch

prometheus_client/decorator.py:402–418  ·  view source on GitHub ↗
(dispatch_args, *args, **kw)

Source from the content-addressed store, hash-verified

400 return lst
401
402 def _dispatch(dispatch_args, *args, **kw):
403 types = tuple(type(arg) for arg in dispatch_args)
404 try: # fast path
405 f = typemap[types]
406 except KeyError:
407 pass
408 else:
409 return f(*args, **kw)
410 combinations = itertools.product(*ancestors(*types))
411 next(combinations) # the first one has been already tried
412 for types_ in combinations:
413 f = typemap.get(types_)
414 if f is not None:
415 return f(*args, **kw)
416
417 # else call the default implementation
418 return func(*args, **kw)
419
420 return FunctionMaker.create(
421 func, 'return _f_(%s, %%(shortsignature)s)' % dispatch_str,

Callers

nothing calls this directly

Calls 3

ancestorsFunction · 0.85
fFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected