HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/idna/__pycache__/cli.cpython-310.pyc
o

;j+�@s�dZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZmZm
Z
ddlmZmZdd	lmZd
edefdd
�Zdejfdd�Zdeedeefdd�Zdedededefdd�Zdde	eedefdd�Zedkr{e�e��dSdS)z{Command-line interface for the :mod:`idna` package.

Invoked via ``python -m idna``. See :func:`main` for the entry point.
�N)�Iterable)�chain)�IO�Optional�)�	IDNAError�decode�encode)�_alabel_prefix�_unicode_dots_re)�__version__�s�returncs&t�d��t�fdd�t�|�D��S)zBReturn True if any label in ``s`` carries the ``xn--`` ACE prefix.�asciic3s�|]
}|�����VqdS�N)�lower�
startswith)�.0Zlabel��prefix��</opt/saltstack/salt/lib/python3.10/site-packages/idna/cli.py�	<genexpr>s�z%_looks_like_alabel.<locals>.<genexpr>)r
r�anyr�split)r
rrr�_looks_like_alabels
rcCs|tjddd�}|��}|jdddddd	d
�|jddddd
dd
�|jdddd�|jdddt��d�|jdddd�|S)Nzpython -m idnau�Convert a domain name between its Unicode (U-label) and ASCII-compatible (A-label) forms. With no mode flag, the direction is chosen from the first input — if it contains an xn-- label the stream is decoded, otherwise it is encoded — and the same mode is applied to every remaining input. UTS #46 mapping is applied by default; pass --strict to disable it. When no domains are given on the command line and stdin is piped, one domain per line is read from stdin.)�prog�descriptionz-ez--encode�mode�store_constr	z+Encode the input to its ASCII A-label form.)�dest�action�const�helpz-dz--decoderz-Decode the input from its ASCII A-label form.z--strict�
store_truezGDisable the default UTS #46 mapping and apply IDNA 2008 rules verbatim.)r!r#z	--version�versionzidna )r!r%�domain�*z=One or more domain names to convert. Omit to read from stdin.)�nargsr#)�argparse�ArgumentParser�add_mutually_exclusive_group�add_argumentr)�parserrrrr�
_build_parsersJ������r.�streamccs"�|D]}|��}|r|VqdS)z@Yield non-empty stripped lines from ``stream``, ignoring blanks.N)�strip)r/�line�strippedrrr�_iter_stdinIs���r3r&r�uts46c
Cs�z|dkrtt||d��Wd
Stt||d��d��Wd
Sty@}ztd|�d|�d|��tjd�WYd}~d	Sd}~ww)zEConvert ``domain`` and write the result; return ``False`` on failure.r)r4rzidna: z failed for z: )�fileNFT)�printrr	r�sys�stderr)r&rr4�errrrr�_convert_oneQs�� ��r:�argvcs�t�}|�|�}|j�|jr|j}ntj��sttj�}n|�d�t	|�}t
|d�}|dur2dS|jp<t|�r;dnd���fdd�t
|g|�D�}t|�rQdSdS)	a�Entry point for ``python -m idna``.

    When more than one domain is supplied (via positional arguments or
    piped stdin) and no mode flag is given, the first input determines
    the direction and that mode is applied uniformly to the rest.

    :param argv: Argument list excluding the program name. Defaults to
        :data:`sys.argv` when ``None``.
    :returns: ``0`` on success, ``1`` if any conversion fails.
    z6a domain argument is required when stdin is a terminalNrrr	csg|]}t|����qSr)r:)rr&�rr4rr�
<listcomp>{szmain.<locals>.<listcomp>r)r.�
parse_args�strictr&r7�stdin�isattyr3�error�iter�nextrrr�all)r;r-�argsZdomains�iterator�first�resultsrr<r�main^s



rJ�__main__r)�__doc__r)r7�collections.abcr�	itertoolsr�typingrr�rrr	�corer
rZpackage_datar�str�boolrr*r.r3r:�list�intrJ�__name__�exitrrrr�<module>s"2
!�