%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/lib/python3/dist-packages/reportlab/lib/__pycache__/
Upload File :
Create Path :
Current File : //proc/self/root/lib/python3/dist-packages/reportlab/lib/__pycache__/sequencer.cpython-312.pyc

�

��d�%����dZdZdj�Zgd�ZdZd�Zd�Zd�Zd�Z	d	�Z
eeee	e
d
�ZGd�d�ZGd
�d�Z
	dad�Zd�Zd�ZddlmZee�[d�Zedk(re�yy)z3.3.0zHA Sequencer class counts things. It aids numbering and formatting lists.z#Sequencer getSequencer setSequencer)
���	�I�
���iI��IVXLCDMc���|dks|dkDrtd��d}d}|rCt|d�\}}t|}|r!t|d�\}}t||z|z}|r�!|dz
}|r�C|S)	Nri�z
illegal value����r�r)�
ValueError�divmod�
_RN_TEMPLATES�_RN_LETTERS)�value�str�base�index�tmps     �9/usr/lib/python3/dist-packages/reportlab/lib/sequencer.py�	_format_Irs����q�y�E�D�L���)�)�
�C�
�D�
��e�R�(���u��E�"�����Q��J�C���e�D�j�)�C�/�C��	
��	��
��J�c�4�t|�j�S�N)r�lower��nums r�	_format_ir!s���S�>���!�!rc��t|�S)zThe simplest formatter)rrs r�_format_123r#"s���s�8�Orc�.�|dz
dz}t|dz�S)zUppercase.  Wraps around at 26.r��A��chr�r �ns  r�_format_ABCr+&���	�a��2�
�A��q��t�9�rc�.�|dz
dz}t|dz�S)zLowercase.  Wraps around at 26.rr%�ar'r)s  r�_format_abcr/+r,r)�I�i�1�A�ac�F�eZdZdZd�Zd�Zdd�Zd�ZeZd�Z	d�Z
d	�Zd
�Zy)�_CounteraPrivate 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�d|_|j|_t|_g|_y�Nr)�_base�_valuer#�
_formatter�_resets��selfs r�__init__z_Counter.__init__@s"����
��j�j���%�����rc��||_yr)r;)r>�
formatFuncs  r�setFormatterz_Counter.setFormatterFs	��$��rNc�:�|r||_y|j|_yr)r:r9)r>rs  r�resetz_Counter.resetIs����D�K��*�*�D�Krc��|xjdz
c_|j}|jD]}|j��|S)Nr)r:r<rD)r>�v�counters   r�nextz
_Counter.nextOs:�����q����K�K���|�|�	�G��M�M�O�	��rc��|jSr)r:r=s r�_thisz_Counter._thisWs���{�{�rc�6�|jt|��S)zReturns next value formatted)r;rHr=s r�nextfz_Counter.nextfZs�����t�D�z�*�*rc�@�|j|j��Sr)r;rJr=s r�thisfz_Counter.thisf^s�����t�z�z�|�,�,rc�X�||jvr|jj|�yyr)r<�append)r>�otherCounters  r�chainz_Counter.chainas%���t�|�|�+��L�L����-�,rr)
�__name__�
__module__�__qualname__�__doc__r?rBrDrH�__next__rJrLrNrR�rrr6r68s6��#��%�%���H��+�-�.rr6c�~�eZdZdZd�Zd�Zdd�Zdd�Zd�Zdd�Z	dd	�Z
dd
�Zdd�Zd�Z
d
�Zdd�Zd�Zd�Zd�Zd�Zy)�	SequenceranSomething 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�@�i|_i|_|j�yr)�	_counters�_formatters�_resetr=s rr?zSequencer.__init__}s�����������
rc��|jj�|jj�|jjtt
tttd��t|j|j��}|jj�|jj|�d|_y)N)r2r3r4r0r1)r\r])r\�clearr]�updater#r+r/rr!�dict�__dict__�_defaultCounter)r>�ds  rr^zSequencer._reset�s�������������� �����������
!�	�
�4�>�>�d�6F�6F�G���
�
�����
�
���Q��#��rNc�v�	|j|S#t$rt�}||j|<|cYSwxYw)zCreates one if not present)r\�KeyErrorr6)r>rG�cnts   r�_getCounterzSequencer._getCounter�s?��	��>�>�'�*�*���	��*�C�&)�D�N�N�7�#��J�	�s��$8�8c�\�|s|j}|j|�j�S)z_Retrieves counter value but does not increment. For
        new counters, sets base value to 1.)rdrirJ�r>rGs  rrJzSequencer._this��,����*�*�G�����(�.�.�0�0rc�J�t|j|j��S�zqRetrieves the numeric value for the given counter, then
        increments it by one.  New counters start at one.)rHrirdr=s rrWzSequencer.__next__�s ���D�$�$�T�%9�%9�:�;�;rc��|st|�S|j}	||_t|�||_S#||_wxYwr)rHrd)r>rG�dcs   rrHzSequencer.next�s?�����:���%�%�B�
*�'.��$��D�z�')��$��r��$�s�4�	=c�\�|s|j}|j|�j�Sr)rdrirNrks  rrNzSequencer.thisf�s*����*�*�G�����(�.�.�0�0rc�\�|s|j}|j|�j�Srn)rdrirLrks  rrLzSequencer.nextf�rlrc��||_y)z$Changes the key used for the defaultN)rd)r>�defaults  r�setDefaultCounterzSequencer.setDefaultCounter�s
��&��rc�"�||j|<y)z�Registers 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)r])r>�format�funcs   r�registerFormatzSequencer.registerFormat�s��$(����� rc�b�|j|}|j|�j|�y)zPSpecifies that the given counter should use
        the given format henceforth.N)r]rirB)r>rGrwrxs    r�	setFormatzSequencer.setFormat�s-������'������!�.�.�t�4rc�L�|s|j}||j|�_yr)rdrir:)r>rGrs   rrDzSequencer.reset�s#����*�*�G�+/�����!�(rc�j�|j|�}|j|�}|j|�yr)rirR)r>�parent�child�p�cs     rrRzSequencer.chain�s-�����V�$�����U�#��	����
rc�`�|dddk(r|dd}|j|�S|j|�S)zrAllows compact notation to support the format function.
        s['key'] gets current value, s['key+'] increments.rN�+)rLrN)r>�keyrGs   r�__getitem__zSequencer.__getitem__�s9���r�s�8�s�?��#�2�h�G��:�:�g�&�&��:�:�c�?�"rc��||zS)z0The crowning jewels - formats multi-level lists.rX)r>�templates  rrwzSequencer.format�s���$��rc	��t|jj��}|j�t	d�|D]=\}}t	d||j�|j|j�fz��?y)z-Write current state to stdout for diagnosticszSequencer dump:z2    %s: value = %d, base = %d, format example = %sN)�listr\�items�sort�printrJr9rN)r>�countersr�rGs    r�dumpzSequencer.dump�sr������,�,�.�/���
�
��
�� �&�	G�N�S�'��F��W�]�]�_�g�m�m�W�]�]�_�JF�F�
G�	Grrr8)rSrTrUrVr?r^rirJrWrHrNrLruryr{rDrRr�rwr�rXrrrZrZesX���.�
$� �1�<�
	*�1�
1�'�(�5�0�
�
#��GrrZNc�.�t�
t�atSr)�
_sequencerrZrXrr�getSequencerr��s�����[�
��rc��t}|a|Sr)r�)�seq�ss  r�setSequencerr��s���A��J��Hrc�:�trtj�yyr)r�r^rXrrr^r^�s�������rr)�register_resetc
���t��tdt��t��t��fz�td�jd��jd��jd�fz�tdt��z��jd�tdt��t��t��fz��j�tdt��t��t��fz�t�td��j	d	d
�td�jd	��d�jd	��d�jd	����d
�}t�td��j
d|��j	dd�tddj�fd�tdd�D��z�t�td��jdd�td�jd�z�td�jd�z�td�jd�z�td�jd�z�td�jd�z�td�jd�z�td�jd�z�td�jd�z�t�td�td�d	z�td�dz�td�dz�td�d	z�t�td�td �td!�z�td!�z�td!�z�y)"Nz)Counting using default sequence: %d %d %dz1Counting Figures: Figure %d, Figure %d, Figure %d�figurezBack to default again: %d�list1zSet default to list1: %d %d %dz#Set default to None again: %d %d %dz0Creating Appendix counter with format A, B, C...�Appendixr3z
    Appendix z, Appendix c��d|dz
dzS)N)�un�deux�trois�quatre�cinqr�rXrs r�
format_frenchztest.<locals>.format_frenchs��4�c�!�e�Q�Y�?�?rz+Defining a custom format with french words:�french�
FrenchListz   � c3�R�K�|]}t�jd����� y�w)r�N)rrL)�.0r1r�s  �r�	<genexpr>ztest.<locals>.<genexpr>s�����J�!�3�q�w�w�|�4�5�J�s�$'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)
rZr�rHrur{rLry�join�rangerR)r�r�s @r�testr�s������A�	�
5��a���a��$�q�'�8R�
R�S�	�
=�	���x��!�&�&��*�A�F�F�8�,<�A>�>�?�	�
%��Q��
/�0����� �	�
*�d�1�g�d�1�g�t�A�w�-G�
G�H�����	�
/�4��7�4��7�D��G�2L�
L�M�	�G�	�
<�=��K�K�
�C� �	�	���
�����
� 3�A�G�G�J�4G�I�J�@�	�G�	�
7�8����X�}�-��K�K��h�'�	�%�#�(�(�J�u�Q�q�z�J�J�
K�L�	�G�	�
F�G��G�G�D���	�-�!�&�&��,�
&�'�	�/�A�F�F�4�L�
(�)�	�/�A�F�F�4�L�
(�)�	�/�A�F�F�4�L�
(�)�	�-�!�&�&��,�
&�'�	�/�A�F�F�4�L�
(�)�	�/�A�F�F�4�L�
(�)�	�/�A�F�F�4�L�
(�)�	�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__rV�split�__all__rrrr!r#r+r/�_type2formatterr6rZr�r�r�r^�reportlab.rl_configr�r�rSrXrr�<module>r�s���
��V��1�7�7�9��N�
����"���
�
�����
��+.�+.�ZGG�GG�R.�
�
��
��
/��v���-4�`�Z���F�r

Zerion Mini Shell 1.0