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

Function _compose_deltas

prometheus_client/openmetrics/parser.py:368–379  ·  view source on GitHub ↗

Takes a list of deltas matches (a dictionary) and a string (the expected delta list name), and processes its elements to compose a tuple of integers representing the deltas

(deltas, deltas_name)

Source from the content-addressed store, hash-verified

366
367
368def _compose_deltas(deltas, deltas_name):
369 """Takes a list of deltas matches (a dictionary) and a string (the expected delta list name),
370 and processes its elements to compose a tuple of integers representing the deltas"""
371 if deltas_name not in deltas:
372 return None
373 out_deltas = deltas.get(deltas_name)
374 if out_deltas is not None and out_deltas.strip():
375 elems = out_deltas.split(',')
376 # Convert each element in the list elems to an integer
377 # after stripping whitespace and create a tuple from these integers.
378 out_deltas_tuple = tuple(int(x.strip()) for x in elems)
379 return out_deltas_tuple
380
381
382def _group_for_sample(sample, name, typ):

Callers 1

_parse_nh_structFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected