
    cj+                     B   d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	 ddl
mZmZmZ ddlmZmZ dd	lmZ d
edefdZdej        fdZdee         dee         fdZdedededefdZdde	ee                  defdZedk    r ej         e                       dS dS )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returnc                     t          j        d          t          fdt          j        |           D                       S )zBReturn True if any label in ``s`` carries the ``xn--`` ACE prefix.asciic              3   f   K   | ]+}|                                                               V  ,d S N)lower
startswith).0labelprefixs     `/home/jenkins/jenkins/workspace/simtester-sanitize/venv/lib/python3.11/site-packages/idna/cli.py	<genexpr>z%_looks_like_alabel.<locals>.<genexpr>   s9      WWEu{{}}''//WWWWWW    )r   r	   anyr   split)r   r   s    @r   _looks_like_alabelr      sC    "7++FWWWW=M=STU=V=VWWWWWWr   c                  f   t          j        dd          } |                                 }|                    dddddd	
           |                    dddddd
           |                     ddd           |                     dddt                      |                     ddd           | S )Nzpython -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--decoder	   z-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versionzidna )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   )parserr"   s     r   _build_parserr2      s   $  F ..00D:     	<     V    
 %%%    
 L    
 Mr   streamc              #   H   K   | D ]}|                                 }|r|V  dS )z@Yield non-empty stripped lines from ``stream``, ignoring blanks.N)strip)r3   linestrippeds      r   _iter_stdinr8   I   s>        ::<< 	NNN r   r*   r"   uts46c           	      .   	 |dk    rt          t          | |                     n1t          t          | |                              d                     n<# t          $ r/}t          d| d| d| t          j                   Y d}~d	S d}~ww xY wd
S )zEConvert ``domain`` and write the result; return ``False`` on failure.r	   )r9   r   zidna: z failed for z: )fileNFT)printr	   r
   r   sysstderr)r*   r"   r9   errs       r   _convert_oner@   Q   s    8&u---....&u---44W==>>>   :t::::S::LLLLuuuuu 4s   AA 
B#$BBargvc                    t                      }|                    |           }|j         |j        r|j        }nMt          j                                        st          t          j                  }n|                    d           t          |          }t          |d          }|dS |j        pt          |          rdndfdt          |g|          D             }t          |          rdndS )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 terminalNr   r	   r
   c                 2    g | ]}t          |          S  )r@   )r   r*   r"   r9   s     r   
<listcomp>zmain.<locals>.<listcomp>{   s%    XXXV|FD%00XXXr   r   )r2   
parse_argsstrictr*   r=   stdinisattyr8   erroriternextr"   r   r   all)	rA   r1   argsdomainsiteratorfirstresultsr"   r9   s	          @@r   mainrS   ^   s     __FT""DOE{ O!%Y Oci((MNNNG}}H4  E}q9M%7%>%>LHDXXXXXueWh?W?WXXXGG#11!#r   __main__r   )__doc__r-   r=   collections.abcr   	itertoolsr   typingr   r    r   r	   r
   corer   r   package_datar   strboolr   r.   r2   r8   r@   listintrS   __name__exitrD   r   r   <module>rb      s   
  



 $ $ $ $ $ $               ' ' ' ' ' ' ' ' ' ' 2 2 2 2 2 2 2 2 % % % % % %X# X$ X X X X/x. / / / /d3 HSM    
 
C 
 
 
 
 
 
$ $xS	" $c $ $ $ $B zCHTTVV r   