
    Vhl                    <    d dl mZ d dlmZ d dlmZ  G d d      Zy)    )annotations)MutableMapping)
merge_hashc                  8    e Zd ZdZd Zd Zd Zd Zd	dZd	dZ	y)
AggregateStatsz: holds stats about per-host activity during playbook runs c                    i | _         i | _        i | _        i | _        i | _        i | _        i | _        i | _        i | _        y N)		processedfailuresokdarkchangedskippedrescuedignoredcustom)selfs    F/home/dcms/DCMS/lib/python3.12/site-packages/ansible/executor/stats.py__init__zAggregateStats.__init__   sC    	     c                ~    d| j                   |<   t        | |      j                  |d      }|dz   t        | |      |<   y)z% helper function to bump a statistic    r   N)r
   getattrget)r   whathostprevs       r   	incrementzAggregateStats.increment*   s@      !td#((q1$(1HdD!r   c                    t        | |      }	 ||   dz
  dk  rt        d      ||xx   dz  cc<   y # t        $ r d||<   Y y w xY w)Nr   r   zDon't be so negative)r   KeyError)r   r   r   _whats       r   	decrementzAggregateStats.decrement1   sU    d#	T{Q"566$K1K 	E$K	s   #2 AAc                   t        | j                  j                  |d      | j                  j                  |d      | j                  j                  |d      | j
                  j                  |d      | j                  j                  |d      | j                  j                  |d      | j                  j                  |d            S )z, return information about a particular host r   )r   r   unreachabler   r   r   r   )	dictr   r   r   r   r   r   r   r   )r   r   s     r   	summarizezAggregateStats.summarize;   s     ww{{4#]]&&tQ/		dA.LL$$T1-LL$$T1-LL$$T1-LL$$T1-
 	
r   Nc                p    |d}|| j                   vr||i| j                   |<   y|| j                   |   |<   y)z allow setting of a custom statN_run)r   r   whichr   r   s       r   set_custom_statszAggregateStats.set_custom_statsH   s?     <Dt{{"!&DKK'+DKKe$r   c                j   |d}|| j                   vs|| j                   |   vr| j                  |||      S t        |t        | j                   |   |               syt        |t              r-t        | j                   |   |   |      | j                   |   |<   y| j                   |   |xx   |z  cc<   y)z# allow aggregation of a custom statNr(   )r   r+   
isinstancetyper   r   r)   s       r   update_custom_statsz"AggregateStats.update_custom_statsR   s     <Dt{{"e4;;t3D&D((d;; $T[[%6u%= >?dN+'1$++d2CE2JD'QDKKe$ KKe$,$r   r	   )
__name__
__module____qualname____doc__r   r   r"   r&   r+   r/    r   r   r   r      s#    D-
,-r   r   N)
__future__r   collections.abcr   ansible.utils.varsr   r   r4   r   r   <module>r8      s   $ # * )I- I-r   