
    ""fI                         d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ dZ	ddZ
d Zd	 Zed
k    r e             dS dS )    N)ArgumentParser)version)ImageWriter)	SVGWriter)BMPGIFJPEGMSPPCXPNGTIFFXBMc                 r   t          d           t          d                    t          j                             t          d           t          d           t          d           t          )t          dd                    t
                               nt          d           t          d           d S )Nz*
python-barcode available barcode formats:z, 
zAvailable image formatszStandard: svgzPillow:zPillow: disabled)printjoinbarcodePROVIDED_BARCODESr   IMG_FORMATS)argsparsers     H/var/www/html/api/venv/lib/python3.11/site-packages/barcode/pybarcode.py
list_typesr      s    	
7888	$))G-
.
.///	$KKK	
#$$$	/i;//0000 !!!	$KKKKK    c                    | j                                         | _         | j         dk    r<| j         t          vr.|                    d                    | j                              | j                                        | _        | j        t
          j        vr.|                    d                    | j                             | j         dk    rd| j         i}t                      }nd| j	        i}t                      }t          j                            t          j                            | j                            }t          j        | j        | j        |||| j                  }t'          d| d	           d S )
NSVGz9Unknown type {type}. Try list action for available types.)typez=Unknown barcode {bc}. Try list action for available barcodes.)bcformatcompresszNew barcode saved as .)r   upperr   errorr   r   lowerr   r   r    r   ospathnormpathabspathoutputgeneratecodetextr   )r   r   optswriteroutnames         r   create_barcoder1      s]   	!!DIyEdi{::GNNY O  	
 	
 	

 <%%''DL|7444KRR< S  	
 	
 	

 yE$)$DM*
'

27??4;77
8
8CDL$)VS$	RRD	
)$
)
)
)*****r   c                     g } t           |                     d           n|                     d           t          dd                    |                     }|                    dddd	t
          z   
           |                    d          }|                    dd          }|                    dd           |                    dd           |                    dddd           |                    ddd           |                    dd           t           |                    ddd            |                    d!d"          }|                    t          #           |                    d$d%t          d&d '           |                                }	 |j        } |||           d S # t          $ r |                    d(           Y d S w xY w))NzAImage output disabled (Pillow not found), --type option disabled.zNImage output enabled, use --type option to give image format (png, jpeg, ...).z!Create standard barcodes via cli. )descriptionepilogz-vz	--versionr   z	%(prog)s )actionr   Actions)titlecreatez(Create a barcode with the given options.)helpr+   zCode to render as barcode.r)   z7Filename for output without extension, e. g. mybarcode.z-cz
--compress
store_truez0Compress output, only recognized if type is svg.)r6   r:   z-bz	--barcodez&Barcode to use [default: %(default)s].z--textzText to show under the barcode.z-tz--typez&Type of output [default: %(default)s].listz$List available image and code types.)funcsvgFcode39)r   r    r=   r   r,   zYou need to tell me what to do.)r   appendr   r   add_argumentr   add_subparsers
add_parserset_defaultsr   r1   
parse_argsr=   AttributeErrorr#   )msgr   
subparserscreate_parserlist_parserr   r=   s          r   mainrK   3   sv   
C

VWWWW

'	
 	
 	
 7  F k)[75J     &&Y&77J))A *  M v,HIIIP     ?	     k H     x.OPPP""(!I 	# 	
 	
 	
 ''; (  K *---UPT     Dy 	T6  8 8 867777778s   "F7 7GG__main__)N)r%   argparser   r   barcode.versionr   barcode.writerr   r   r   r   r1   rK   __name__ r   r   <module>rR      s    				 # # # # # #  # # # # # # & & & & & & $ $ $ $ $ $H
 
 
 
+ + +42 2 2j zDFFFFF r   