Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/common/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyo

�
�Udac@`s�ddlmZmZmZeZddlZddlmZe	d
d�Z
e	d�Ze	d�Ze	d�Z
d�Zd	�ZdS(i(tabsolute_importtdivisiontprint_functionN(tdeepcopyc	`s���fd��i}x�|j�D]�\}}t|t�rn||krnt|��|t|d��<q%t|t�r�||kr��|�|t|d��<q%||t|d��<q%W|S(s
    reversible allows two way conversion of a camelized dict
    such that snake_dict_to_camel_dict(camel_dict_to_snake_dict(x)) == x

    This is achieved through mapping e.g. HTTPEndpoint to h_t_t_p_endpoint
    where the default would be simply http_endpoint, which gets turned into
    HttpEndpoint if recamelized.

    ignore_list is used to avoid converting a sub-tree of a dict. This is
    particularly important for tags, where keys are case-sensitive. We convert
    the 'Tags' key but nothing below.
    c`sug}xh|D]`}t|t�r;|jt|���q
t|t�r`|j�|��q
|j|�q
W|S(N(t
isinstancetdicttappendtcamel_dict_to_snake_dicttlist(t
camel_listtchecked_listtitem(t
reversiblet
value_is_list(sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyR
s
R(titemsRRRt_camel_to_snakeR(t
camel_dictRtignore_listt
snake_dicttktv((RR
sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyRs
"c`st�fd���||�S(s�
    Perhaps unexpectedly, snake_dict_to_camel_dict returns dromedaryCase
    rather than true CamelCase. Passing capitalize_first=True returns
    CamelCase. The default remains False as that was the original implementation
    c`s�|dkrdSt|��}t|t�rbx~|D]&}�|||�|t||�<q5WnMt|t�r�x;tt|��D] }|j�|||��q�Wn|S|S(N(	tNonettypeRRt_snake_to_camelRtrangetlenR(tcomplex_typetcapitalize_firsttnew_typetkeyti(tcamelize(sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyR<s
'!(tFalse(RR((RsT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pytsnake_dict_to_camel_dict5scC`s_|r&djd�|jd�D��S|jd�ddjd�|jd�dD��SdS(Ntcs`s!|]}|j�pdVqdS(t_N(t
capitalize(t.0tx((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pys	<genexpr>OsR#ics`s!|]}|j�pdVqdS(R#N(R$(R%R&((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pys	<genexpr>Qsi(tjointsplit(tsnakeR((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyRMs cC`s�d�}|rd}nd}tj|||�}|jd�r_|jd�r_|d}n|ri|Sd}d}tj|d|�}tj|d|�j�S(	NcS`sd|jd�j�S(NR#i(tgrouptlower(tm((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pytprepend_underscore_and_lowerVss[A-Z]s[A-Z]{3,}s$R#is(.)([A-Z][a-z]+)s([a-z0-9])([A-Z]+)s\1_\2(tretsubt
startswithR+(tnameRR-t
upper_patternts1tfirst_cap_patterntall_cap_patternts2((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyRTs		
cC`s�t|t�s|St|�}xc|j�D]U\}}||krqt||t�rqt|||�||<q,t|�||<q,W|S(s�recursively merges dicts. not just simple a['key'] = b['key'], if
    both a and b have a key whose value is a dict then dict_merge is called
    on both values and the result stored in the returned dictionary.(RRRRt
dict_merge(tatbtresultRR((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyR7nsc`s't�fd��j�D��}t�fd��j�D��}x�t�j��t�j��@D]�}t�|t�r�t�|t�r�t�|�|�}|r|d||<|d||<qqg�|�|krg�|||<�|||<qgqgW|s|r||fSdSdS(Nc3`s-|]#\}}|�kr||fVqdS(N((R%RR(tdict2(sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pys	<genexpr>~sc3`s-|]#\}}|�kr||fVqdS(N((R%RR(tdict1(sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pys	<genexpr>sii(RRtsettkeysRtrecursive_diffR(R<R;tlefttrightRR:((R<R;sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyR?}s"")&
((t
__future__RRRRt
__metaclass__R.tcopyRR RR!RRR7R?(((sT/usr/lib/python2.7/site-packages/ansible/module_utils/common/dict_transformations.pyt<module>s'	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]