U mf@sddlZddlZddlZddlZddlmZdZedjZ edjZ edj Z edj Z ddZdd Zdd d ZGd d d ZeeeeeeeedddZdS)N)ListiisddcCst|||||d<dS)N)_pack_two_doubles_func)dataposvalue timestampr I/opt/hc_python/lib/python3.8/site-packages/prometheus_client/mmap_dict.py_pack_two_doublessr cCst||||d<dS)N)_pack_integer_func)rrrr r r _pack_integersrccs|dkrt|dd}d}||krt||d}|||krDtd|d7}||||}|d|dd}||7}t||\}}|d|||fV|d7}qdS)zr r r rFs   zMmapedDict.closeN)F) __name__ __module__ __qualname____doc__r/ staticmethodr4r=rrBrDrErFr r r r r2s  r) metric_namename labelnames labelvalues help_textreturncCs$tt||}tj||||gddS)z&Format a key for use in the mmap file.T) sort_keys)dictzipjsondumps)rLrMrNrOrPlabelsr r r mmap_keysrX)r)rUr$rr9typingrr"Structr:rr unpack_fromrrr rrrstrrXr r r r s      [