
    Vh                     Z    d dl mZmZmZ eZdZd dlmZ d dl	m
Z
 d dlmZ  G d de      Zy)	    )absolute_importdivisionprint_functionz
    name: fish
    short_description: fish shell (/bin/fish)
    description:
      - This is here because some people are restricted to fish.
    extends_documentation_fragment:
      - shell_common
)	text_type)shlex_quote)ShellModulec                   T    e Zd Z ed      ZdZdZdZdZdZ	dZ
dZd	Zd	Zd
 ZddZd Zy)r   )fishr
   
z> /dev/null 2>&1z; andz; or() c                 0   | j                   j                         }|j                  |       g }|j                         D ]F  \  }}||j	                  d|z         |j	                  d|dt        t        |            d       H dj                  |      S )Nz
set -e %s;zset -lx  ;)envcopyupdateitemsappendr   r   join)selfkwargsr   retkvs         d/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ansible/posix/plugins/shell/fish.py
env_prefixzShellModule.env_prefix%   s}    hhmmo

6LLN 	NDAqy

<!+,

q+il2KLM		N
 xx}    Nc                     |j                         dk7  rt        |      }|j                         |j                  dd      j                         |g}||j                  |       dj	                  |      }|S )Nr   z#!r   )stripr   replacer   r   )r   
env_stringshebangcmdarg_path	cmd_partsnew_cmds          r   build_module_commandz ShellModule.build_module_command0   sj    99;"c"C%%'r)B)H)H)JCP	X&((9%r   c                 H   t        |      }dt        ||| j                  | j                        z  }dj	                  ||| j
                        dj	                  ||| j
                        g}d| j                  z  j                  |      }|d|d| j                  d|d	}|S )
Nzset rc flag; [ -r %(p)s ] %(shell_or)s set rc 2; [ -f %(p)s ] %(shell_or)s set rc 1; [ -d %(p)s ] %(shell_and)s set rc 3; %(i)s -V 2>/dev/null %(shell_or)s set rc 4; [ x"$rc" != "xflag" ] %(shell_and)s echo "$rc  "%(p)s %(shell_and)s exit 0)pi	shell_andshell_ora  ({0} -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();{2}afile = open("'{1}'", "rb"){2}buf = afile.read(BLOCKSIZE){2}while len(buf) > 0:{2}	hasher.update(buf){2}	buf = afile.read(BLOCKSIZE){2}afile.close(){2}print(hasher.hexdigest())' 2>/dev/null)z({0} -c 'import sha; BLOCKSIZE = 65536; hasher = sha.sha();{2}afile = open("'{1}'", "rb"){2}buf = afile.read(BLOCKSIZE){2}while len(buf) > 0:{2}	hasher.update(buf){2}	buf = afile.read(BLOCKSIZE){2}afile.close(){2}print(hasher.hexdigest())' 2>/dev/null)z %s z; r   z (echo '0  'r   )r   dict
_SHELL_AND	_SHELL_ORformat_SHELL_EMBEDDED_PY_EOLr   )r   pathpython_interpshell_escaped_pathtestcsumsr%   s          r   checksumzShellModule.checksum:   s   8 ). H  KO  Rd  hu  AE  AP  AP  [_  [i  [i  Kj  j [  b  b  cp  rD  FJ  Fa  Fa  b R  Y  Y  Zg  i{  }A  }X  }X  Y

 &,,U3.2CI[\
r   )N)__name__
__module____qualname__	frozensetCOMPATIBLE_SHELLSSHELL_FAMILYr3   _SHELL_REDIRECT_ALLNULLr0   r1   _SHELL_SUB_LEFT_SHELL_SUB_RIGHT_SHELL_GROUP_LEFT_SHELL_GROUP_RIGHTr   r)   r9    r   r   r   r      sP     "),L!0JIO	%r   r   N)
__future__r   r   r   type__metaclass__DOCUMENTATIONansible.module_utils.sixr   ansible.module_utils.six.movesr   ansible.plugins.shell.shr   ShModulerE   r   r   <module>rN      s3    C B / 6 <J( Jr   