
    Vh                        d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 ddl
mZ ddlmZmZmZ ddlmZ d Z G d	 d
ee      Z G d de      Z ee       G d de             Zy)z6
Hold command line arguments for use in other modules
    )annotations)ABCMeta)	ContainerMappingSequenceSet)ImmutableDict)add_metaclassbinary_type	text_type)	Singletonc                x   t        | t        t        f      r| S t        | t              rIi }| j	                         D ])  \  }}t        |t
              rt        |      ||<   %|||<   + t        |      S t        | t              rXt               }| D ]>  }t        |t
              r|j                  t        |             .|j                  |       @ t        |      S t        | t              rPg }| D ]>  }t        |t
              r|j                  t        |             .|j                  |       @ t        |      S | S )zRRecursively convert a container and objects inside of it into immutable data types)
isinstancer   r   r   itemsr   _make_immutabler	   r   setadd	frozensetr   appendtuple)obj	temp_dictkeyvaluetemp_settemp_sequences         M/home/dcms/DCMS/lib/python3.12/site-packages/ansible/utils/context_objects.pyr   r      s   #	;/0
	C	!	))+ 	'JC%+!0!7	#!&	#		'
 Y''	C	5 	$E%+_U34U#		$
 ""	C	" 	,E%+$$_U%;<$$U+		,
 ]##J    c                      e Zd ZdZy)_ABCSingletonz
    Combine ABCMeta based classes with Singleton based classes

    Combine Singleton and ABCMeta so we have a metaclass that unambiguously knows which can override
    the other.  Useful for making new types of containers which are also Singletons.
    N__name__
__module____qualname____doc__ r   r   r    r    2   s     	r   r    c                  2     e Zd ZdZ fdZed        Z xZS )CLIArgsa/  
    Hold a parsed copy of cli arguments

    We have both this non-Singleton version and the Singleton, GlobalCLIArgs, version to leave us
    room to implement a Context object in the future.  Whereas there should only be one set of args
    in a global context, individual Context objects might want to pretend that they have different
    command line switches to trigger different behaviour when they run.  So if we support Contexts
    in the future, they would use CLIArgs instead of GlobalCLIArgs to store their version of command
    line flags.
    c                |    i }|j                         D ]  \  }}t        |      ||<    t        t        |   |       y N)r   r   superr(   __init__)selfmappingtoplevelr   r   	__class__s        r   r,   zCLIArgs.__init__G   s>    !--/ 	3JC+E2HSM	3gt%h/r   c                $     | t        |            S r*   )vars)clsoptionss     r   from_optionszCLIArgs.from_optionsM   s    4=!!r   )r"   r#   r$   r%   r,   classmethodr5   __classcell__)r0   s   @r   r(   r(   <   s!    	0 " "r   r(   c                      e Zd ZdZy)GlobalCLIArgsz|
    Globally hold a parsed copy of cli arguments.

    Only one of these exist per program as it is for global context
    Nr!   r&   r   r   r9   r9   R   s    
 	r   r9   N)r%   
__future__r   abcr   collections.abcr   r   r   r   'ansible.module_utils.common.collectionsr	   ansible.module_utils.sixr
   r   r   ansible.utils.singletonr   r   r    r(   r9   r&   r   r   <module>r@      sd    #  = = A J J -B	Iw 	"m ", }	G 	 	r   