
    Vho                    p    d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ  e       Z G d de      Zy	)
    )annotations)MutableMapping)	constants)AnsibleError)cache_loader)Displayc                  ^     e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Z fdZ xZS )	FactCachec                    t        j                  t        j                        | _        | j                  st        dt        j                  z        t        t        | "  |i | y )Nz+Unable to load the facts cache plugin (%s).)	r   getCCACHE_PLUGIN_pluginr   superr
   __init__)selfargskwargs	__class__s      G/home/dcms/DCMS/lib/python3.12/site-packages/ansible/vars/fact_cache.pyr   zFactCache.__init__   sL    #''7||LPQP^P^_``i'88    c                z    | j                   j                  |      st        | j                   j                  |      S N)r   containsKeyErrorr   r   keys     r   __getitem__zFactCache.__getitem__   s.    ||$$S)N||$$r   c                <    | j                   j                  ||       y r   )r   set)r   r   values      r   __setitem__zFactCache.__setitem__"   s    e$r   c                :    | j                   j                  |       y r   )r   deleter   s     r   __delitem__zFactCache.__delitem__%   s    C r   c                8    | j                   j                  |      S r   )r   r   r   s     r   __contains__zFactCache.__contains__(   s    ||$$S))r   c                H    t        | j                  j                               S r   )iterr   keysr   s    r   __iter__zFactCache.__iter__+   s    DLL%%'((r   c                H    t        | j                  j                               S r   )lenr   r*   r+   s    r   __len__zFactCache.__len__.   s    4<<$$&''r   c                    t        |       S )z@ Return a primitive copy of the keys and values from the cache. )dictr+   s    r   copyzFactCache.copy1   s    Dzr   c                6    | j                   j                         S r   )r   r*   r+   s    r   r*   zFactCache.keys5   s    ||  ""r   c                8    | j                   j                          y)z# Flush the fact cache of all keys. N)r   flushr+   s    r   r5   zFactCache.flush8   s    r   c                    ||i}	 | j                   j                  |      }|r|j                  |       |||<   t        t
        |   |       y # t        $ r Y w xY wr   )r   r   updater   r   r
   )r   r   r!   
host_facts
host_cacher   s        r   first_order_mergezFactCache.first_order_merge<   sd    5\
	))#.J!!%(",
3 	i%j1  		s   3A 	AA)__name__
__module____qualname__r   r   r"   r%   r'   r,   r/   r2   r*   r5   r:   __classcell__)r   s   @r   r
   r
      s?    9%
%!*)(#2 2r   r
   N)
__future__r   collections.abcr   ansibler   r   ansible.errorsr   ansible.plugins.loaderr   ansible.utils.displayr   displayr
    r   r   <module>rG      s.    # * " ' / ) )42 42r   