o nnhl @s6ddlmZddlmZddlmZGdddZdS)) annotations)MutableMapping) merge_hashc@sDeZdZdZddZddZddZdd Zdd d Zdd dZ d S)AggregateStatsz: holds stats about per-host activity during playbook runs cCs:i|_i|_i|_i|_i|_i|_i|_i|_i|_dSN) processedfailuresokdarkchangedskippedrescuedignoredcustom)selfrA/usr/local/lib/python3.10/dist-packages/ansible/executor/stats.py__init__s zAggregateStats.__init__cCs2d|j|<t|||d}|dt|||<dS)z% helper function to bump a statistic rN)rgetattrget)rwhathostprevrrr increment*s zAggregateStats.incrementcCsVt||}z||ddkrtd||d8<WdSty*d||<YdSw)NrrzDon't be so negative)rKeyError)rrr_whatrrr decrement1s  zAggregateStats.decrementc Cs\t|j|d|j|d|j|d|j|d|j|d|j|d|j|ddS)z, return information about a particular host r)r r unreachabler r r r) dictr rrr r r r r)rrrrr summarize;s       zAggregateStats.summarizeNcCs:|durd}||jvr||i|j|<dS||j||<dS)z allow setting of a custom statN_run)rrwhichrrrrrset_custom_statsHs  zAggregateStats.set_custom_statscCs|durd}||jvs||j|vr||||St|t|j||s'dSt|tr=t|j||||j||<dS|j|||7<dS)z# allow aggregation of a custom statNr!)rr$ isinstancetyperrr"rrrupdate_custom_statsRs "z"AggregateStats.update_custom_statsr) __name__ __module__ __qualname____doc__rrrr r$r'rrrrrs  rN) __future__rcollections.abcransible.utils.varsrrrrrrs