
k4Vdc           @   s  d  d l  m Z d  d l m Z d  d l m Z d  d l m Z ik d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d  6d! d" 6d# d$ 6d% d& 6d' d( 6d) d* 6d+ d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6dQ dR 6dS dT 6dU dV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d_ d` 6da db 6dc dd 6de df 6dg dh 6di dj 6dk dl 6dm dn 6do dp 6dq dr 6ds dt 6du dv 6dw dx 6dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z d\ Z	 Z
 Z Z ig d d 6d d 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d  d 6d" d 6d$ d 6d& d 6d( d 6d* d 6d, d 6d. d 6d0 d 6d2 d 6d4 d 6d6 d 6d8 d 6d: d 6d< d 6d> d 6d@ d 6dB d 6dD d 6dF d 6dH d 6dJ d 6dL d 6dN d 6dP d 6dR d6dT d6dV d6dX d6dZ d6d\ d6d^ d6d` d6db d	6dd d
6df d6dh d6dj d6dl d6dn d6dp d6dr d6dt d6dv d6dx d6dz d6d| d6d~ d6d d6d d6d d6d d6d d6d d6d d6d d6d d 6d d!6d d"6d d#6d d$6d d%6d d&6d d'6d d(6d d)6d d*6d d+6d d,6d d-6d d.6d d/6d d06d d16d d26d d36d d46d d56d d66d d76d d86d d96d d:6d d;6d d<6d d=6d d>6d d?6d d@6d dA6Z ig d d 6d d 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d d 6d  d 6d" d 6d$ d 6d& d 6d( d 6d* d 6d, d 6d. d 6d0 d 6d2 d 6d4 d 6d6 d 6d8 d 6d: d 6d< d 6d> d 6d@ d 6dB d 6dD d 6dF d 6dH d 6dJ d 6dL d 6dN d 6dP d 6dR d6dT d6dV d6dX d6dZ d6d\ d6d^ d6d` d6db d	6dd d
6df d6dh d6dj d6dl d6dn d6dp d6dr d6dt d6dv d6dx d6dz d6d| d6d~ d6d d6d d6d d6d dB6d dC6d dD6d dE6d dF6d dG6d dH6d dI6d dJ6d dK6d dL6d dM6d dN6d dO6d dP6d dQ6d dR6d dS6d dT6d dU6d dV6d dW6d dX6d dY6d dZ6d d[6d d\6d d]6d d^6d d_6d d`6d da6d d;6d d<6d d=6d d>6d d@6d db6d dA6Z ig d dc6d dd6d
 de6d df6d dg6d dh6d di6d dj6d dk6d dl6d dm6d dn6d do6d  dp6d" dq6d$ dr6d& ds6d( dt6d* du6d, dv6d. dw6d0 dx6d2 dy6d4 dz6d6 d{6d8 d|6d: d}6d< d~6d> d6d@ d6dB d6dD d6dF d6dH d6dJ d6dL d6dN d6dP d6dR d6dT d6dV d6dX d6dZ d6d\ d6d^ d6d` d6db d6dd d6df d6dh d6dj d6dl d6dn d6dp d6dr d6dt d6dv d6dx d6dz d6d| d6d~ d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d6d d?6d db6d dA6Z i e e f db6e e f d?6e df d>6e	 e e f d6e
 e e f d6e e df d6Z dZ e e j    Z de f d    YZ de f d    YZ e dk rd  Z e   n  dS(  i(   t   inch(   t   asNative(   t   MultiWidthBarcode(   t   digitst   BaBbBbi    t   BbBaBbi   t   BbBbBai   t   AbAbBci   t   AbAcBbi   t   AcAbBbi   t   AbBbAci   t   AbBcAbi   t   AcBbAbi   t   BbAbAci	   t   BbAcAbi
   t   BcAbAbi   t   AaBbCbi   t   AbBaCbi   t   AbBbCai   t   AaCbBbi   t   AbCaBbi   t   AbCbBai   t   BbCbAai   t   BbAaCbi   t   BbAbCai   t   BaCbAbi   t   BbCaAbi   t   CaBaCai   t   CaAbBbi   t   CbAaBbi   t   CbAbBai   t   CaBbAbi   t   CbBaAbi   t   CbBbAai   t   BaBaBci   t   BaBcBai   t   BcBaBai    t   AaAcBci!   t   AcAaBci"   t   AcAcBai#   t   AaBcAci$   t   AcBaAci%   t   AcBcAai&   t   BaAcAci'   t   BcAaAci(   t   BcAcAai)   t   AaBaCci*   t   AaBcCai+   t   AcBaCai,   t   AaCaBci-   t   AaCcBai.   t   AcCaBai/   t   CaCaBai0   t   BaAcCai1   t   BcAaCai2   t   BaCaAci3   t   BaCcAai4   t   BaCaCai5   t   CaAaBci6   t   CaAcBai7   t   CcAaBai8   t   CaBaAci9   t   CaBcAai:   t   CcBaAai;   t   CaDaAai<   t   BbAdAai=   t   DcAaAai>   t   AaAbBdi?   t   AaAdBbi@   t   AbAaBdiA   t   AbAdBaiB   t   AdAaBbiC   t   AdAbBaiD   t   AaBbAdiE   t   AaBdAbiF   t   AbBaAdiG   t   AbBdAaiH   t   AdBaAbiI   t   AdBbAaiJ   t   BdAbAaiK   t   BbAaAdiL   t   DaCaAaiM   t   BdAaAbiN   t   AcDaAaiO   t   AaAbDbiP   t   AbAaDbiQ   t   AbAbDaiR   t   AaDbAbiS   t   AbDaAbiT   t   AbDbAaiU   t   DaAbAbiV   t   DbAaAbiW   t   DbAbAaiX   t   BaBaDaiY   t   BaDaBaiZ   t   DaBaBai[   t   AaAaDci\   t   AaAcDai]   t   AcAaDai^   t   AaDaAci_   t   AaDcAai`   t   DaAaAcia   t   DaAcAaib   t   AaCaDaic   t   AaDaCaid   t   CaAaDaie   t   DaAaCaif   t   BaAdAbig   t   BaAbAdih   t   BaAbCbii   t   BcCaAaBij   t    t   !t   "t   #t   $t   %t   &s   't   (t   )t   *t   +t   ,t   -t   .t   /t   0t   1t   2t   3t   4t   5t   6t   7t   8t   9t   :t   ;t   <t   =t   >t   ?t   @t   At   Bt   Ct   Dt   Et   Ft   Gt   Ht   It   Jt   Kt   Lt   Mt   Nt   Ot   Pt   Qt   Rt   St   Tt   Ut   Vt   Wt   Xt   Yt   Zt   [s   \t   ]t   ^t   _s    s   s   s   s   s   s   s   s   s   	s   
s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   s   t   SHIFTt   TO_Ct   TO_Bs   s   t   `t   at   bt   ct   dt   et   ft   gt   ht   it   jt   kt   lt   mt   nt   ot   pt   qt   rt   st   tt   ut   vt   wt   xt   yt   zt   {t   |t   }t   ~s   t   TO_At   00t   01t   02t   03t   04t   05t   06t   07t   08t   09t   10t   11t   12t   13t   14t   15t   16t   17t   18t   19t   20t   21t   22t   23t   24t   25t   26t   27t   28t   29t   30t   31t   32t   33t   34t   35t   36t   37t   38t   39t   40t   41t   42t   43t   44t   45t   46t   47t   48t   49t   50t   51t   52t   53t   54t   55t   56t   57t   58t   59t   60t   61t   62t   63t   64t   65t   66t   67t   68t   69t   70t   71t   72t   73t   74t   75t   76t   77t   78t   79t   80t   81t   82t   83t   84t   85t   86t   87t   88t   89t   90t   91t   92t   93t   94t   95t   96t   97t   98t   99t   START_At   START_Bt   START_Ct   Code128c           B   si   e  Z d  Z e d Z d
 Z d
 Z d Z d
 Z	 d d  Z
 d   Z d   Z d   Z d   Z d	   Z RS(   s  
    Code 128 is a very compact symbology that can encode the entire
    128 character ASCII set, plus 4 special control codes,
    (FNC1-FNC4, expressed in the input string as  to ).
    Code 128 can also encode digits at double density (2 per byte)
    and has a mandatory checksum.  Code 128 is well supported and
    commonly used -- for example, by UPS for tracking labels.
    
    Because of these qualities, Code 128 is probably the best choice
    for a linear symbology today (assuming you have a choice).

    Options that may be passed to constructor:

        value (int, or numeric string. required.):
            The value to encode.
   
        barWidth (float, default .0075):
            X-Dimension, or width of the smallest element
            Minumum is .0075 inch (7.5 mils).
            
        barHeight (float, see default below):
            Height of the symbol.  Default is the height of the two
            bearer bars (if they exist) plus the greater of .25 inch
            or .15 times the symbol's length.

        quiet (bool, default 1):
            Wether to include quiet zones in the symbol.
            
        lquiet (float, see default below):
            Quiet zone size to left of code, if quiet is true.
            Default is the greater of .25 inch, or 10 barWidth
            
        rquiet (float, defaults as above):
            Quiet zone size to right left of code, if quiet is true.
            
    Sources of Information on Code 128:

    http://www.semiconductor.agilent.com/barcode/sg/Misc/code_128.html
    http://www.adams1.com/pub/russadam/128code.html
    http://www.barcodeman.com/c128.html

    Official Spec, "ANSI/AIM BC4-1999, ISS" is available for US$45 from
    http://www.aimglobal.org/aimstore/
    gQ~?i   t    c         K   s   t  | t  r t |  n	 t |  } x* | j   D] \ } } t |  | |  q4 W|  j r |  j d  k r t	 t
 d |  j d  |  _ n  |  j d  k r t	 t
 d |  j d  |  _ q n d |  _ |  _ t j |  |  d  S(   Ng      ?g      $@g        (   t
   isinstancet   intt   strR   t   itemst   setattrt   quiett   lquiett   Nonet   maxR    t   barWidtht   rquietR   t   __init__(   t   selft   valuet   argsR   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyRD     s    '	 #c         C   sg   d } d |  _  xH |  j D]= } t |  d k rL | d k rL d |  _  q n  | | } q W| |  _ | S(   NR8  i   i   s   i    (   t   validRF  t   ordt	   validated(   RE  t   vvalR   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt   validate   s    			c         C   s%  d } g  } x| t  |  k  r | } g  } d } x| t  |  k  r3| | t k rb | } Pq6 | | d k r | j | |  | d 7} q6 q6 | | t k r | | d t k r | j | | | | d  | d 7} | d 7} q6 q6 | | t k r/| | d d k r/g  } d }	 | }
 x |
 | k r| |
 d k ra| j | |  |
 d 8}
 q'| |
 t k r| |
 d t k r| j | |
 d | |
  |	 d 7}	 |
 d 8}
 q'Pq'W| j   |	 | t | d k o| o| d t k  d k r/| | | 7} | d 7} | } ~ | d 7} q/n  Pq6 W| | d k pM| | k } | d k op| op| d t k } | t |  t |  k r| r| d d  d } | d =n d } | | g | 7} | r| j d	 | | d
  n  | j | |  n | | | | d !7} | d 7} q W| S(   s?   Improved version of old _trailingDigitsToC(self, l) inspired byi    is   i   i   t   STOPR   R   t   TOi(   t   lent   cStartst   appendR   t   reverseR:  (   RE  R   R   t   nlt   startpost   rlt   savingsR   t   rrlt   rsavingsR   t   tat   xst   toc(    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt	   _try_TO_C   sn    


$$

6
"
c   	      C   s  |  j  } d g } x= | D]5 } | t k rA | d | d g } q | j |  q W| j d  |  j |  } | d t k r d | d d g | d *n  t | d	 \ } } } | g } | d d !} x | rg| d	 } | d
 k r| | | | | d g } | d } q | t k rI| j | |  t | \ } } | d } q | j | |  | d } q W| d	 } x/ t d t |   D] } | | | | } qW| | d t g |  _	 |  j	 S(   NR5  R   R   RM  i   t   START_ii   i    R   ig   (
   RJ  t   setbRQ  R\  t   tost   setmapt   rangeRO  t   stopt   encoded(	   RE  R   R   R   t   startt   sett   shsetR   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt   encode9  s:    				

c         C   s3   d j  g  |  j D] } t | ^ q  |  _ |  j S(   NR8  (   t   joinRc  t	   _patternst
   decomposed(   RE  R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt	   decomposed  s    ,c         C   s   |  j  S(   N(   RF  (   RE  (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt
   _humanTexth  s    N(   t   __name__t
   __module__t   __doc__R    RB  R@  R?  RC  R>  t	   barHeightRD  RL  R\  Rg  Rk  Rl  (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyR7     s   ,
		>	+	t   Code128Autoc           B   s   e  Z d  Z d   Z RS(   s   contributed by https://bitbucket.org/kylemacfarlane/
    see https://bitbucket.org/rptlab/reportlab/issues/69/implementations-of-code-128-auto-and-data
    c         C   s'  |  j  } d  } g  } t |  } x | r | j d  } | t k rq | rq | d t k rq | | j d  7} n  | t k r d } n | t k r d } n d } | | k r | r | j d |  n | j d |  | } n  | j |  q$ W| j d  t | d \ } } }	 | g }
 | d d	 !} x | r| d } | d
 k rt|
 | | |	 | d g }
 | d } q/| t	 k r|
 j | |  t | \ } }	 | d } q/|
 j | |  | d } q/W|
 d } x/ t
 d t |
   D] } | | |
 | } qW|
 | d t g |  _ |  j S(   Ni    R   R   R   t   TO_R]  RM  i   iR   i   ig   (   RJ  R@  t   listt   popR   t   setcR^  RQ  R`  R_  Ra  RO  Rb  Rc  (   RE  R   t   current_setR   RF  R   t   set_Rd  Re  Rf  R   R   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyRg  o  sN    		"					

(   Rm  Rn  Ro  Rg  (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyRq  k  s   t   __main__c          C   s  d d l  m }  d d l m } m } d d l m } m } d d l m	 } d d l
 m } d d l m } d d  l } |   }	 |	 d }
 |	 d	 } g  } | j } xJ d$ D]B } | | | d" | |
  |  |  g   | | | |   q W| d#  j |  d  S(%   Ni(   R7  (   t   Spacert   SimpleDocTemplate(   R    t   cm(   t   getSampleStyleSheet(   t	   Paragraph(   t   KeepTogethert   Normalt   Heading1t   BBBB123456BBBt   BBBB12345BBBt   BBBB1234BBBt
   BBBB123BBBt	   BBBB12BBBt   BBBB1BBBt   BBBB123456aat
   BBBB1234aat	   BBBB123aat   BBBB12aat   BBBB1aat
   BBBB123456t	   BBBB12345t   BBBB1234t   BBBB123t   BBBB12t   BBBB1s   1234Bs   Ba1234Bt   Ba12t   Ba123Bt   Ba1234Bt   BBBB1234567t   BBBB1234567aas   Code 128 %rs   code128-out.pdf(   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  s   1234Bs   Ba1234BR  R  R  R  R  (   t"   reportlab.graphics.barcode.code128R7  t   reportlab.platypusRy  Rz  t   reportlab.lib.unitsR    R{  t   reportlab.lib.stylesR|  t   reportlab.platypus.paragraphR}  t   reportlab.platypus.flowablesR~  t   osRQ  t   build(   R7  Ry  Rz  R    R{  R|  R}  R~  R  t   stylest   styleNt   styleHt   storyt   storyAddR   (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt   main  sP    	

	                       
)N(   ig   ih   ii   ij   (   R5  R   R   (   R  R    t   reportlab.lib.utilsR   t!   reportlab.graphics.barcode.commonR   t   stringR   Ri  t   startat   startbt   startcRb  t   setaR^  Ru  R@  R`  RP  Rs  t   keysR_  R7  Rq  Rm  R  (    (    (    sp   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/reportlab/graphics/barcode/code128.pyt   <module>!   s  ####################7	*