%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.9/site-packages/ansible/module_utils/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.9/site-packages/ansible/module_utils/__pycache__/splitter.cpython-39.pyc

a

�)g2%�@sDddlmZmZmZeZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dS)
�)�absolute_import�division�print_functioncCsTd}t|�D]B\}}|dkr(||d}|dvr|dkr|rJ||krNd}q|}q|S)z�
    the goal of this block is to determine if the quoted string
    is unterminated in which case it needs to be put back together
    Nr�z"'�\)�	enumerate)�token�
quote_charZ	prev_char�idxZcur_char�r�A/usr/lib/python3.9/site-packages/ansible/module_utils/splitter.py�_get_quote_state!sr
cCs8|�|�}|�|�}||kr4|||7}|dkr4d}|S)z�
    this function counts the number of opening/closing blocks for a
    given opening/closing type and adjusts the current depth for that
    block based on the difference
    r)�count)rZ	cur_depthZ
open_tokenZclose_tokenZnum_openZ	num_closerrr�_count_jinja2_blocks5s

rcCs�g}|��}z|�d�}d}Wnty4d}Yn0|�d�}d}d}d}d}d}t|�D�]2\}	}
|
���d�}d}t|�D�]�\}
}|dkr�|s�d}q�|}t||�}|du}d}|r�|s�|�|�d}n�|s�|s�|s�|s�|�r�|
dk�r|�s|�rd	|d
|f|d
<npt|�dk�rHd}|
dk�r0d}d
|d
||f|d
<n8d}|d
�d��sj|
dk�rjd}d
|d
||f|d
<d}|}t	||dd�}||k�r�|�s�|�|�d}|}t	||dd�}||k�r�|�s�|�|�d}|}t	||dd�}||k�r|�s|�|�d}|s�|s�|s�|s�|s�|dkr�|�|�q�t|�dk�r�|	t|�dk�r�|�s�|d
�d��r||
dk�r�|d
d7<d}q\|�s�|�s�|�s�|�r�t
d��|�r�dd�|D�}|S)a
    Splits args on whitespace, but intelligently reassembles
    those that may have been split over a jinja2 block or quotes.

    When used in a remote module, we won't ever have to be concerned about
    jinja2 blocks, however this function is/will be used in the
    core portions as well before the args are templated.

    example input: a=b c="foo bar"
    example output: ['a=b', 'c="foo bar"']

    Basically this is a variation shlex that has some more intelligence for
    how Ansible needs to use it.
    �utf-8TF�
Nr� rz%s%s���r�z%s%s%sz{{z}}z{%z%}z{#z#}zLerror while splitting arguments, either an unbalanced jinja2 block or quotescSsg|]}|�d��qS)r)�decode)�.0�xrrr�
<listcomp>��zsplit_args.<locals>.<listcomp>)�strip�encode�UnicodeDecodeError�splitrr
�append�len�endswithr�	Exception)�args�paramsZ	do_decode�itemsr	Z
inside_quotesZprint_depthZblock_depthZ
comment_depthZitemidx�item�tokensZline_continuationr
rZwas_inside_quotesZappendedZspacerZprev_print_depthZprev_block_depthZprev_comment_depthrrr�
split_argsDs�









&r'cCs<t|�dko:|ddkr$|ddkp:|ddko:|ddkS)Nr�"r�')r��datarrr�	is_quoted�sr,cCst|�r|dd�S|S)za removes first and last quotes from a string, if the string starts and ends with the same quotes rr)r,r*rrr�unquote�sr-N)Z
__future__rrr�typeZ
__metaclass__r
rr'r,r-rrrr�<module>s

Zerion Mini Shell 1.0