?Hg rddlZddlZejdZejdZGddeZdS)NTzcloudlinux-summaryc eZdZdZddddgdgddiddiddigd Zdejdefded zd e e effd Z dejdefd ed eded zd d f dZ d S)StatisticsDictz> Special class to store all metrics before sending it z-42igE) strintfloatstr_listint_listint_dict float_dictstr_dict rpm_stat_listfunc. log_messageNreturnc |}n6#t$r)}|rtd||Yd}~dSd}~wwxYwd|fS)a Method for catching any exceptions while calling the passed function, logging them and returning None and success flag if an exception has been encountered. Returns a formatted result of the function call otherwise. :param func: function that should be called :param log_message: if given, it will be logged as exception message. z%s. Exception: "%s"N)FNT) Exceptionlogger exception)selfrrresulterrs F/opt/cloudlinux/venv/lib/python3.11/site-packages/clsummary/storage.py evaluate_safezStatisticsDict.evaluate_safe)sw TVVFF      ) ;;;;; V|s A;Atype_of_resultname_of_metricc`|||\}}|s |j|}|||<dS)z Calls `evaluate_safe` and saves the result from it in the metric dictionary. :param log_message: if given, it will be logged as exception message. See method `evaluate_safe` for more details. N)rDEFAULT_RESULTS)rrrrrsuccessrs r add_metriczStatisticsDict.add_metricEsJ ,,      :).9F%^) __name__ __module__ __qualname____doc__rtypingCallablerrtupleboolrr r!rrrs GE 3  5  5 #O(/#q&)t tQw 8&/#q&)& & & t &  &&&&&&r!r)loggingr&TypeVarr getLoggerrdictrr*r!rr/s{ FN3  / 0 0N&N&N&N&N&TN&N&N&N&N&r!