File: //proc/self/root/usr/lib/python3.6/site-packages/qrcode/__pycache__/console_scripts.cpython-36.pyc
3
Nlagz � @ s� d Z ddlZddlZddlZddlZejjd�r@ddlZej� ddddd d
�Z ej
ejejej
d�Zejdd� fd
d�Zedkr�e� dS )z�
qr - Convert stdin (or the first argument) to a QR Code.
When stdout is a tty the QR Code is printed to the terminal and when stdout is
a pipe to a file an image is written. The default image format is PNG.
� N�win�cygwinzqrcode.image.pil.PilImagezqrcode.image.pure.PymagingImagezqrcode.image.svg.SvgImagez!qrcode.image.svg.SvgFragmentImagezqrcode.image.svg.SvgPathImage)ZpilZpymagingZsvgzsvg-fragmentzsvg-path)�L�M�Q�H� c
C s� t jtj� d�}|jddjdjttj � ���d� |jdt
dd� |jd d
ttj � �ddd
� |j| �\}} t
jt|j d�}|jr�tj|j|j�}d|kr�|jd� |jdd�\}}t|i g |g�}t||�}nd }| r�| d }nttjdtj�} | j� }|jd k�r|j|� n|j||jd� |d k�rPtjtjj� ��rP|jdd� d S |j|d�}
tjj � ttjdd �}|�s�tj!dk�r�dd l"}|j#tjj� tj$� tj}|
j%|� d S )N)Zusagez --factoryz�Full python path to the image factory class to create the image with. You can use the following shortcuts to the built-in image factory classes: {0}.z, )�helpz
--optimizez�Optimize the data by looking for chunks of at least this many characters that could use a more efficient encoding method. Use 0 to turn off chunk optimization.)�typer z--error-correctionZchoicer z^The error correction level to use. Choices are L (7%), M (15%, default), Q (25%), and H (30%).)r
�choices�defaultr )�error_correction�.z+The image factory is not a full python pathr r �buffer)�optimizeT)Ztty)�
image_factoryZwin32)&�optparseZOptionParser�__doc__�stripZ
add_option�format�join�sorted�default_factories�keys�intr
�
parse_args�qrcodeZQRCode�factory�get�error�rsplit�
__import__�getattr�sys�stdin�readr Zadd_data�os�isatty�stdout�filenoZprint_asciiZ
make_image�flush�platform�msvcrtZsetmodeZO_BINARYZsave)
�args�parserZoptsZqr�module�nameZimpr �dataZstdin_bufferZimgZ
stdout_bufferr, � r2 �%/usr/lib/python3.6/console_scripts.py�main sP
r4 �__main__)r r )r r# r r&