관리-도구
편집 파일: splitter.cpython-39.pyc
a �����)gV,����������������������@���s����d�dl�mZmZmZ�eZd�dlZd�dlZd�dlm Z �d�dl mZ�d�dlm Z �dZe�d�ed�ed �ed ��ejejB��Zdd��Zddd�Zdd��Zdd��Zdd��Zdd��ZdS�)�����)�absolute_import�division�print_functionN)�AnsibleParserError)�to_text)�unquotez[a-fA-F0-9]z� ( \\U{0} # 8-digit hex escapes | \\u{1} # 4-digit hex escapes | \\x{2} # 2-digit hex escapes | \\N\{{[^}}]+\}} # Unicode characters by name | \\[\\'"abfnrtv] # Single-character escapes )������������c�����������������C���s���dd��}t��||��S�)Nc�����������������S���s���t��|��d�d�S�)Nr���zunicode-escape)�codecs�decode�group)�match��r����</usr/lib/python3.9/site-packages/ansible/parsing/splitter.py�decode_match+���s����z%_decode_escapes.<locals>.decode_match)�_ESCAPE_SEQUENCE_RE�sub)�sr���r���r���r����_decode_escapes*���s����r���Fc�������������� ���C���s���t�|�dd�}�i�}|�du�r�zt|��}W�nr�tyV�}�ztd|d��W�Y�d}~nLd}~0��ty��}�z,dt|����v�r�td|d��n��W�Y�d}~n d}~0�0�g�}|D�]�}t|�}d|v��rfd } z0|�d| d ��} | d kr�|| d ��dkr�q�q�W�n*�t�y���|� |� dd���Y�q�Y�n0�|d| ��} || d �d��}|�rP| d v�rP|� |��nt|����|| ���<�q�|� |��q�t |�d k�r�t|�|d<�|S�)a�� Convert a string of key/value items to a dict. If any free-form params are found and the check_raw option is set to True, they will be added to a new parameter called '_raw_params'. If check_raw is not enabled, they will simply be ignored. Zpassthru)Z nonstringNzUnable to parse argument string)Zorig_exczno closing quotationz;error parsing argument string, try quoting the entire line.�=r��������\z\=)ZcreatesZremoves�chdir� executable�warn�stdinZstdin_add_newlineZstrip_empty_endsZ_raw_params)r���� split_args� IndexErrorr���� ValueError�str�lowerr����index�append�replacer����strip�len� join_args)�argsZ check_raw�optionsZvargs�e�veZ raw_paramsZorig_x�x�pos�k�vr���r���r����parse_kv1���s@���� r0���c�����������������C���sT���d}t�|��D�]B\}}|dkr(|�|d��}|dv�r|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���r���z"'r���)� enumerate)�token� quote_charZ prev_char�idxZcur_charr���r���r����_get_quote_statej���s����r5���c�����������������C���s8���|���|�}|���|�}||kr4|||�7�}|dk�r4d}|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)r2���Z cur_depthZ open_tokenZclose_tokenZnum_openZ num_closer���r���r����_count_jinja2_blocks~���s���� r7���c�����������������C���s>���d}|�D�]0}t�|�dks"|�d�r,||7�}q|d|�7�}q|S�)z Join the original cmd based on manipulations by split_args(). This retains the original newlines and whitespaces. ��r���� � )r&����endswith)r����result�pr���r���r���r'�������s���� r'���c�����������������C���st��g�}|���d�}d}d}d}d}d}t|�D��]\}} | ��d�} d}t| �D��]�\}} t| �dkrz|dkrz|d��d7��<�qJ| dkr�|s�d}qJ|}t| |�}|du}d}|r�|s�|s�|s�|s�|�| ��d}n�|s�|s�|s�|s�|�rV|dk�r|�rd |d�| f�|d<�nLt| �d k�r>d}|dk�r&d}d|d�|| f�|d<�nd |d�| f�|d<�d}|}t| |dd�}||k�r�|�s�|�| ��d}|}t| |dd�}||k�r�|�s�|�| ��d}|}t| |dd�}||k�r�|�s�|�| ��d}|sJ|sJ|sJ|sJ|sJ| dkrJ|�| ��qJt|�d k�rD|t|�d �k�rD|�sD|d��d7��<�d}q*|�sb|�sb|�sb|�rptd�|����|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. r9���NFr���r:������r���Tz%s%sr���r8���z%s%s%sz%s %sz{{z}}z{%z%}z{#z#}zOfailed at splitting arguments, either an unbalanced jinja2 block or quotes: {0})�splitr1���r&���r5���r#���r7���r����format)r(����params�itemsr3���Z inside_quotesZprint_depthZblock_depthZ comment_depthZitemidx�item�tokensZline_continuationr4���r2���Zwas_inside_quotesZappendedZspacerZprev_print_depthZprev_block_depthZprev_comment_depthr���r���r���r�������sr���� &r���)F)Z __future__r���r���r����typeZ __metaclass__r����reZansible.errorsr���Zansible.module_utils._textr���Zansible.parsing.quotingr���Z_HEXCHAR�compiler@����UNICODE�VERBOSEr���r���r0���r5���r7���r'���r���r���r���r���r����<module>���s$���� � 9