o n¾nhÚ ã@s¦dZddlmZddlmZddlmZmZmZm Z ddl m Z ddl m Z mZmZddlmZdd „ZGd d „d eeƒZGd d „d e ƒZe eƒGdd„deƒƒZdS)z6 Hold command line arguments for use in other modules é)Ú annotations)ÚABCMeta)Ú ContainerÚMappingÚSequenceÚSet)Ú ImmutableDict)Ú add_metaclassÚ binary_typeÚ text_type)Ú SingletoncCsèt|ttfƒr |St|tƒr-i}| ¡D]\}}t|tƒr$t|ƒ||<q|||<qt|ƒSt|tƒrPt ƒ}|D]}t|tƒrF|  t|ƒ¡q7|  |¡q7t |ƒSt|t ƒrrg}|D]}t|tƒrh|  t|ƒ¡qY|  |¡qYt|ƒS|S)zRRecursively convert a container and objects inside of it into immutable data types)Ú isinstancer r rÚitemsrÚ_make_immutablerrÚsetÚaddÚ frozensetrÚappendÚtuple)ÚobjÚ temp_dictÚkeyÚvalueÚtemp_setÚ temp_sequence©rúH/usr/local/lib/python3.10/dist-packages/ansible/utils/context_objects.pyrs0         rc@óeZdZdZdS)Ú _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__rrrrr2srcs,eZdZdZ‡fdd„Zedd„ƒZ‡ZS)Ú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. cs6i}| ¡D] \}}t|ƒ||<qtt|ƒ |¡dS©N)rrÚsuperr$Ú__init__)ÚselfÚmappingÚtoplevelrr©Ú __class__rrr'GszCLIArgs.__init__cCs |t|ƒƒSr%)Úvars)ÚclsÚoptionsrrrÚ from_optionsMs zCLIArgs.from_options)r r!r"r#r'Ú classmethodr0Ú __classcell__rrr+rr$<s  r$c@r)Ú GlobalCLIArgsz| Globally hold a parsed copy of cli arguments. Only one of these exist per program as it is for global context Nrrrrrr3Rsr3N)r#Ú __future__rÚabcrÚcollections.abcrrrrÚ'ansible.module_utils.common.collectionsrÚansible.module_utils.sixr r r Úansible.utils.singletonr rrr$r3rrrrÚs    !