
    Q?h%                         S r SrSR                  5       r/ SQrSrS rS rS rS r	S	 r
\\\\	\
S
.r " S S5      r " S S5      r SqS rS rS rSSKJr  \" \5        CS r\S:X  a  \" 5         gg)z3.3.0zHA Sequencer class counts things. It aids numbering and formatting lists.z#Sequencer getSequencer setSequencer)
       	   I   
            iI     IVXLCDMc                     U S:  d  U S:  a  [        S5      eSnSnU (       aQ  [        U S5      u  p[        U   nU(       a%  [        US5      u  pC[        X2-      U-   nU(       a  M%  US-  nU (       a  MQ  U$ )	Nr   i  zillegal value r      r   )
ValueErrordivmod_RN_TEMPLATES_RN_LETTERS)valuestrbaseindextmps        I/var/www/html/env/lib/python3.13/site-packages/reportlab/lib/sequencer.py	_format_Ir      s    qyEDL))
CD
eR(E"QJCej)C/C c 		 % J    c                 4    [        U 5      R                  5       $ N)r   lowernums    r   	_format_ir!      s    S>!!r   c                     [        U 5      $ )zThe simplest formatter)r   r   s    r   _format_123r#   "   s    s8Or   c                 .    U S-
  S-  n[        US-   5      $ )zUppercase.  Wraps around at 26.r      A   chrr    ns     r   _format_ABCr+   &       	a2Aqt9r   c                 .    U S-
  S-  n[        US-   5      $ )zLowercase.  Wraps around at 26.r   r%   a   r'   r)   s     r   _format_abcr/   +   r,   r   )Ii1Aac                   P    \ rS rSrSrS rS rSS jrS r\r	S r
S	 rS
 rS rSrg)_Counter8   a
  Private class used by Sequencer.  Each counter
knows its format, and the IDs of anything it
resets, as well as its value. Starts at zero
and increments just before you get the new value,
so that it is still 'Chapter 5' and not 'Chapter 6'
when you print 'Figure 5.1'c                 X    SU l         U R                   U l        [        U l        / U l        g Nr   )_base_valuer#   
_formatter_resetsselfs    r   __init___Counter.__init__@   s"    
jj%r   c                     Xl         g r   )r<   )r?   
formatFuncs     r   setFormatter_Counter.setFormatterF   s    $r   Nc                 B    U(       a  Xl         g U R                  U l         g r   )r;   r:   )r?   r   s     r   reset_Counter.resetI   s    K**DKr   c                     U =R                   S-  sl         U R                   nU R                   H  nUR                  5         M     U$ )Nr   )r;   r=   rG   )r?   vcounters      r   next_Counter.nextO   s5    qKK||GMMO $r   c                     U R                   $ r   )r;   r>   s    r   _this_Counter._thisW   s    {{r   c                 6    U R                  [        U 5      5      $ )zReturns next value formatted)r<   rL   r>   s    r   nextf_Counter.nextfZ   s    tDz**r   c                 @    U R                  U R                  5       5      $ r   )r<   rO   r>   s    r   thisf_Counter.thisf^   s    tzz|,,r   c                 Z    XR                   ;  a  U R                   R                  U5        g g r   )r=   append)r?   otherCounters     r   chain_Counter.chaina   s#    ||+LL- ,r   )r:   r<   r=   r;   r   )__name__
__module____qualname____firstlineno____doc__r@   rD   rG   rL   __next__rO   rR   rU   rZ   __static_attributes__ r   r   r6   r6   8   s6    #%% H+-.r   r6   c                       \ rS rSrSrS rS rSS jrSS jrS r	SS	 jr
SS
 jrSS jrSS jrS rS rSS jrS rS rS rS rSrg)	Sequencere   a  Something to make it easy to number paragraphs, sections,
images and anything else.  The features include registering
new string formats for sequences, and 'chains' whereby
some counters are reset when their parents.
It keeps track of a number of
'counters', which are created on request:
Usage::

    >>> seq = layout.Sequencer()
    >>> seq.next('Bullets')
    1
    >>> seq.next('Bullets')
    2
    >>> seq.next('Bullets')
    3
    >>> seq.reset('Bullets')
    >>> seq.next('Bullets')
    1
    >>> seq.next('Figures')
    1
    >>>
c                 @    0 U l         0 U l        U R                  5         g r   )	_counters_formatters_resetr>   s    r   r@   Sequencer.__init__}   s    r   c                    U R                   R                  5         U R                  R                  5         U R                  R                  [        [
        [        [        [        S.5        [        U R                   U R                  S9nU R                  R                  5         U R                  R                  U5        S U l        g )N)r2   r3   r4   r0   r1   )rh   ri   )rh   clearri   updater#   r+   r/   r   r!   dict__dict___defaultCounter)r?   ds     r   rj   Sequencer._reset   s     ! 	 4>>d6F6FGQ#r   Nc                 v     U R                   U   $ ! [         a    [        5       nX R                   U'   Us $ f = f)zCreates one if not present)rh   KeyErrorr6   )r?   rK   cnts      r   _getCounterSequencer._getCounter   s=    	>>'** 	*C&)NN7#J	s    $88c                 f    U(       d  U R                   nU R                  U5      R                  5       $ )zWRetrieves counter value but does not increment. For
new counters, sets base value to 1.)rq   rw   rO   r?   rK   s     r   rO   Sequencer._this   ,     **G(..00r   c                 J    [        U R                  U R                  5      5      $ ziRetrieves the numeric value for the given counter, then
increments it by one.  New counters start at one.)rL   rw   rq   r>   s    r   ra   Sequencer.__next__   s      D$$T%9%9:;;r   c                     U(       d  [        U 5      $ U R                  n Xl        [        U 5      X l        $ ! X l        f = fr   )rL   rq   )r?   rK   dcs      r   rL   Sequencer.next   s9    :%%B*'.$Dz')$r$s   7 ?c                 f    U(       d  U R                   nU R                  U5      R                  5       $ r   )rq   rw   rU   rz   s     r   rU   Sequencer.thisf   s*    **G(..00r   c                 f    U(       d  U R                   nU R                  U5      R                  5       $ r~   )rq   rw   rR   rz   s     r   rR   Sequencer.nextf   r|   r   c                     Xl         g)z$Changes the key used for the defaultN)rq   )r?   defaults     r   setDefaultCounterSequencer.setDefaultCounter   s    &r   c                      X R                   U'   g)zRegisters a new formatting function.  The funtion
must take a number as argument and return a string;
fmt is a short menmonic string used to access it.N)ri   )r?   formatfuncs      r   registerFormatSequencer.registerFormat   s     $( r   c                 b    U R                   U   nU R                  U5      R                  U5        g)zHSpecifies that the given counter should use
the given format henceforth.N)ri   rw   rD   )r?   rK   r   r   s       r   	setFormatSequencer.setFormat   s-     '!..t4r   c                 T    U(       d  U R                   nX R                  U5      l        g r   )rq   rw   r;   )r?   rK   r   s      r   rG   Sequencer.reset   s!    **G+/!(r   c                 j    U R                  U5      nU R                  U5      nUR                  U5        g r   )rw   rZ   )r?   parentchildpcs        r   rZ   Sequencer.chain   s-    V$U#	
r   c                 b    USS S:X  a  USS nU R                  U5      $ U R                  U5      $ )zjAllows compact notation to support the format function.
s['key'] gets current value, s['key+'] increments.r   N+)rR   rU   )r?   keyrK   s      r   __getitem__Sequencer.__getitem__   s9     rs8s?#2hG::g&&::c?"r   c                 
    X-  $ )z0The crowning jewels - formats multi-level lists.rc   )r?   templates     r   r   Sequencer.format   s
    r   c           	         [        U R                  R                  5       5      nUR                  5         [	        S5        U H<  u  p#[	        SX#R                  5       UR                  UR                  5       4-  5        M>     g)z-Write current state to stdout for diagnosticszSequencer dump:z2    %s: value = %d, base = %d, format example = %sN)listrh   itemssortprintrO   r:   rU   )r?   countersr   rK   s       r   dumpSequencer.dump   sg    ,,./ &NSF]]_gmmW]]_JF F G 'r   )rh   rq   ri   r   r9   )r\   r]   r^   r_   r`   r@   rj   rw   rO   ra   rL   rU   rR   r   r   r   rG   rZ   r   r   r   rb   rc   r   r   re   re   e   sX    .
$ 1<
	*1
1'(50

#Gr   re   Nc                  0    [         c
  [        5       q [         $ r   )
_sequencerre   rc   r   r   getSequencerr      s    [
r   c                     [         nU q U$ r   )r   )seqss     r   setSequencerr      s    AJHr   c                  D    [         (       a  [         R                  5         g g r   )r   rj   rc   r   r   rj   rj      s    z r   r   )register_resetc            
      "  ^ [        5       m[        S[        T5      [        T5      [        T5      4-  5        [        STR                  S5      TR                  S5      TR                  S5      4-  5        [        S[        T5      -  5        TR                  S5        [        S[        T5      [        T5      [        T5      4-  5        TR                  5         [        S[        T5      [        T5      [        T5      4-  5        [        5         [        S5        TR	                  S	S
5        [        STR                  S	5      < STR                  S	5      < STR                  S	5      < 35        S n [        5         [        S5        TR                  SU 5        TR	                  SS5        [        SSR                  U4S j[        SS5       5       5      -   5        [        5         [        S5        TR                  SS5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        STR                  S5      -  5        [        5         [        S5        [        STS	   -  5        [        STS   -  5        [        STS   -  5        [        STS	   -  5        [        5         [        S5        [        S 5        [        S!T-  5        [        S!T-  5        [        S!T-  5        g )"Nz)Counting using default sequence: %d %d %dz1Counting Figures: Figure %d, Figure %d, Figure %dfigurezBack to default again: %dlist1zSet default to list1: %d %d %dz#Set default to None again: %d %d %dz0Creating Appendix counter with format A, B, C...Appendixr3   z    Appendix z, Appendix c                     SU S-
  S-     $ )N)undeuxtroisquatrecinqr      rc   r   s    r   format_frenchtest.<locals>.format_french  s    4c!eQY??r   z+Defining a custom format with french words:french
FrenchListz    c              3   X   >#    U  H  n[        TR                  S 5      5      v   M!     g7f)r   N)r   rR   ).0r1   r   s     r   	<genexpr>test.<locals>.<genexpr>  s"     Jz!3qww|455zs   '*r      z:Chaining H1 and H2 - H2 goes back to one when H1 increasesH1H2z    H1 = %dz      H2 = %dz-GetItem notation - append a plus to incrementz    seq["Appendix"] = %sz    seq["Appendix+"] = %sz	Appendix+z8Finally, string format notation for nested lists.  Cool!z>The expression ("Figure %(Chapter)s.%(Figure+)s" % seq) gives:z"    Figure %(Chapter)s.%(Figure+)s)
re   r   rL   r   r   rR   r   joinrangerZ   )r   r   s    @r   testr     s   A	
5aa$q'8R
RS	
=	x!&&*AFF8,<A> > ?	
%Q
/0 	
*d1gd1gtAw-G
GH	
/4747DG2L
LM	G	
<=KK
C 		

 3AGGJ4GI J@	G	
78X}-KKh'	%#((JuQqzJJ
KL	G	
FGGGD	-!&&,
&'	/AFF4L
()	/AFF4L
()	/AFF4L
()	-!&&,
&'	/AFF4L
()	/AFF4L
()	/AFF4L
()	G	
9:	
$q}
45	
%+
67	
%+
67	
$q}
45	G	
DE	
JK	
.
23	
.
23	
.
23r   __main__)__version__r`   split__all__r   r   r   r!   r#   r+   r/   _type2formatterr6   re   r   r   r   rj   reportlab.rl_configr   r   r\   rc   r   r   <module>r      s    V1779 N"
 
+. +.ZGG GGR .

 / v -4` ZF r   