
    kf                     f    d Z ddlmZmZmZ ddlmZ d Z G d de          Z G d d          Z	d	S )
zHhelper for importing pdf structures into a ReportLab generated document
    )format	PDFObject	pdfdocEnc)strTypesc                    t          t          t                    rt          nt          f}|t          t          fz   }| D ]}t          ||          srt          |          dk    rt          dt          |          z             t          |d         t                    s%t          dt          |d                   z             d S )N   zTsequence elts must be strings/bytes/PDFPatternIfs or singletons containing strings: r   zCSingletons must contain strings/bytes or PDFObject instances only: )
isinstancer   tupler   PDFPatternIflen
ValueErrorascii)pattern_sequenceallowedTypesxs      \/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/reportlab/pdfbase/pdfpattern.py_patternSequenceCheckr      s    )(E::K88L9\"::L t t!L)) 	t1vvqyy !wx}~  yA  yA  "A  B  B  Bad8,, t !fglmnopmqgrgr!rssst t    c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	
PDFPatternr   c                 @    t          |           || _        || _        dS )a  
        Description of a kind of PDF object using a pattern.

        Pattern sequence should contain strings, singletons of form [string] or
        PDFPatternIf objects.
        Strings are literal strings to be used in the object.
        Singletons are names of keyword arguments to include.
        PDFpatternIf objects allow some conditionality.
        Keyword arguments can be non-instances which are substituted directly in string conversion,
        or they can be object instances in which case they should be pdfdoc.* style
        objects with a x.format(doc) method.
        Keyword arguments may be set on initialization or subsequently using __setitem__, before format.
        "constant object" instances can also be inserted in the patterns.
        N)r   pattern	arguments)selfr   keywordargss      r   __init__zPDFPattern.__init__   s%     	.///'$r   c                     || j         |<   d S Nr   )r   itemvalues      r   __setitem__zPDFPattern.__setitem__%   s    $tr   c                     | j         |         S r   r   )r   r    s     r   __getitem__zPDFPattern.__getitem__(   s    ~d##r   c              #     K   | j         }| j        }|D ]v}t          |t                    rt	          |          V  *t          |t
                    r|                    |          V  Wt          |t                    r\t          | 	                    |j
                            }|o|d         }| 	                    |r|j        n|j                  D ]}|V  |d         }|                    |d           }	|	t          dt          |          z            t          |	t
                    rt          |	|          V  0t          |	t                    rt	          |	          V  Xt	          t!          |	                    V  xd S )Nr   z%s value not defined)r   _PDFPattern__documentr	   r   r   r   r   r   listevalcondthenPartelsePartgetr   r   str)
r   Lr   documentr   resultr)   znamer!   s
             r   r(   zPDFPattern.eval+   s     N	? 	0 	0A!H%% 0ll""""Ai(( 0hhx((((((Al++ 0dii//00+&)#E1::1:FF  AGGGG t!dD11=$%;eDkk%IJJJeI.. 0 x000000h// 0#E******#CJJ//////)	0 	0r   c                 ~    || _         	 d                    |                     | j                            | ` S # | ` w xY w)Nr   )r&   joinr(   r   )r   r/   s     r   r   zPDFPattern.formatD   sC    "	 88DIIdl3344s   ,8 <c                 t    t                               | j                  }| j        |_        | j        |_        |S r   )object__new__	__class__r   r   )r   cs     r   clonezPDFPattern.cloneK   s,    NN4>**L	nr   N)
__name__
__module____qualname____RefOnly__r   r"   r$   r(   r   r:    r   r   r   r      ss        K% % %&% % %$ $ $0 0 02         r   r   c                       e Zd ZdZg g fdZdS )r   zcond will be evaluated as [cond] in PDFpattern eval.
    It should evaluate to a list with value 0/1 etc etc.
    thenPart is a list to be evaluated if the cond evaulates true,
    elsePart is the false sequence.
    c                     t          |t                    s|g}|||fD ]}t          |           || _        || _        || _        d S r   )r	   r'   r   r)   r*   r+   )r   r)   r*   r+   r   s        r   r   zPDFPatternIf.__init__W   sX    $t$$3dVdx) 	% 	%A!!$$$$	  r   N)r;   r<   r=   __doc__r   r?   r   r   r   r   Q   s9         
 %' ! ! ! ! ! !r   r   N)
rB   reportlab.pdfbase.pdfdocr   r   r   reportlab.lib.utilsr   r   r   r   r?   r   r   <module>rE      s   	 A A A A A A A A A A ( ( ( ( ( (t t t? ? ? ? ? ? ? ?B! ! ! ! ! ! ! ! ! !r   