%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/lib/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/lib/__pycache__/attrmap.cpython-312.pyc

�

C��e���dZdZddlmZmZddlmZddlmZGd�d�Z	Gd�d	�Z
Gd
�de�Zd�Z
dd
�Zd�Zd�Zdd�Zy)z3.3.0a�Framework for objects whose assignments are checked. Used by graphics.

We developed reportlab/graphics prior to Python 2 and metaclasses. For the
graphics, we wanted to be able to declare the attributes of a class, check
them on assignment, and convert from string arguments.  Examples of
attrmap-based objects can be found in reportlab/graphics/shapes.  It lets
us defined structures like the one below, which are seen more modern form in
Django models and other frameworks.

We'll probably replace this one day soon, hopefully with no impact on client
code.

class Rect(SolidShape):
    """Rectangle, possibly with rounded corners."""

    _attrMap = AttrMap(BASE=SolidShape,
        x = AttrMapValue(isNumber),
        y = AttrMapValue(isNumber),
        width = AttrMapValue(isNumber),
        height = AttrMapValue(isNumber),
        rx = AttrMapValue(isNumber),
        ry = AttrMapValue(isNumber),
        )


�)�
isAnything�DerivedValue)�isSeq)�	rl_configc��eZdZdZd�Zd�Zy)�
CallableValuez(a class to allow callable initial valuesc�.�||_||_||_y�N��func�args�kw)�selfrr
rs    �7/usr/lib/python3/dist-packages/reportlab/lib/attrmap.py�__init__zCallableValue.__init__%s����	���	����c�N�|j|ji|j��Sr
r)rs r�__call__zCallableValue.__call__+s ���t�y�y�$�)�)�.�d�g�g�.�.rN)�__name__�
__module__�__qualname__�__doc__rr�rrrr#s��2��/rrc�$�eZdZdZdd�Zd�Zd�Zy)�AttrMapValuez,Simple multi-value holder for attribute mapsNc��|xst|_||_||_||_|j�D]\}}t
|||��yr
)r�validate�desc�_initial�_advancedUsage�items�setattr)rrr�initial�
advancedUsager�k�vs        rrzAttrMapValue.__init__0sI�� �.�J��
���	���
�+����8�8�:�	�C�A�a��D��1��	rc��|dk(r6t|jt�r|j�S|jS|dk(ryt|��)Nr#�hiddenr)�
isinstancerr�AttributeError)r�names  r�__getattr__zAttrMapValue.__getattr__8sA����?��$�-�-�
�6�t�}�}��8N��=�=� �
�8�^���T�"�"rc��ddj|jj�D�cgc]}d|z��	c}�zScc}w)NzAttrMapValue(%s)z, z%s=%r)�join�__dict__r!)r�is  r�__repr__zAttrMapValue.__repr__As5��!�D�I�I�D�M�M�DW�DW�DY�.Z�q�w��{�.Z�$[�[�[��.Zs�>
)NNNr)rrrrrr,r1rrrrr.s��6��#�\rrc�(�eZdZdgfd�Zd�Zgfd�Zy)�AttrMapNc�D�i}|rdt|t�r|}nQt|�s|f}|D]>}t|d|�}||ur|s�|j	|��)tdt
|�z��tj||�|j|�|j	|�y)N�_attrMapzBASE=%s has wrong kind of value)
r)r3r�getattr�update�
ValueError�ascii�dictr�remove)r�BASE�UNWANTEDr�data�B�ams       rrzAttrMap.__init__Es�������$�w�'����T�{�D�7�D��W�A� ��:�d�3�B���~��t�{�{�2��(�)J�U�ST�X�)U�V�V�W�	
�
�
�d�4� ����H�����B�rc�8�|D]}	||=�y#t$rY�wxYwr
)�KeyError)r�unwantedr%s   rr;zAttrMap.removeWs1���	�A�
���G�	���
��
�s�
�	�c�B�t||��}|j|�|S)N)r<r=)r3r7)rr=r�cs    r�clonez
AttrMap.clone^s����x�0��	������r)rrrrr;rFrrrr3r3Ds�����$��rr3c��tjr�|j}|r�|ddk7r�t|t�rn�||vrB||j
}	||�}|s�t
d|�d|�d|jj����t|j|d
�}t|t�r>t|dd
�}|r
|||�y
t
|jj�d|�d���t
d
|�d|jj����t|j|d
�}t|t�r>t|dd
�}|r
|||�y
t
|jj�d|�d���|dk(r6|jj�|jj|�y
||j|<y
#t$r7}|j|jj�d|�d|�d|�d	��|�d
}~wwxYw)z validate setattr(obj,name,value)r�_zIllegal assignment of z to z
 in class �.� �(�)N�fsetz has no setterzIllegal attribute 'z' in class r/)r�
shapeCheckingr5r)rrr*�	__class__r�	Exceptionr6�propertyr/�clearr7)	�objr+�value�aMapr�r�e�proprMs	         r�validateSetattrrYcs�������|�|���D��G�c�M��%��.�������:�.�.��}� ���A��,�/E�e�Y�d�SW�RX�Xb�cf�cp�cp�cy�cy�bz�-{�|�|��s�}�}�T�$�7���d�8�,�"�4��t�4�D���S����,��
�
�0F�0F�/G�q���n�-]�^�^�(�QU�WZ�Wd�Wd�Wm�Wm�)n�o�o��3�=�=��d�+�D��$�x� ��t�F�4�(�����U�O� �C�M�M�$:�$:�#;�1�T�F�.�!Q�R�R�	
�z�	������������E�"�"����T���7!�g��+�+����)?�)?�(@��$��q��
�RS�TY�S\�\]�&^�_�ef�f��g�s�F8�8	G8�2G3�3G8c��|j}t|jdd�}|r||ur|j�|fS|dfS||ur|j�|_yy)zclone obj._attrMap if requiredr5N)r5r6rOrF)rS�ret�A�oAs    r�_privateAttrMapr^�sY�����A�	����z�$�	/�B�
�
��7��7�7�9�b�=� ��d�7�N�
��7��7�7�9�C�L�rc�|�|jd�}t|�dk(ry|ddD]}t||�}�||dfS)zPLocate the object src.P for P a string, return parent and name of attribute
    rIr)NN���)�split�lenr6)�src�P�ps   r�_findObjectAndAttrrf�sM��	
�����A�
�1�v��{���1�R��	"�A��#�q�/�C�	"��A�b�E�z�rc
���t|d�sW|j}ddl}|j|j|f|j
zgt
|dd�tfd�d��|_yy)N�
__attrproxy__r�__setattr__c��|||||�Sr
r)rr%r&�osa�hooks     r�<lambda>z!hook__setattr__.<locals>.<lambda>�s��Y]�^b�cd�ef�gj�Yk�r)rhri)�hasattrrO�new�classobjr�	__bases__r6rl)rS�Cros   r�hook__setattr__rs�s\���3��'��M�M����l�l�1�:�:�q�d�1�;�;�.>��.5�c�-��.M�SW�k�
m�n��
�(rNc���t|d�sJd��t|d�\}}t|�s|f}g}g}	|D]6}
t|
�r
|
d|
dd}}
t||
�\}}
|s�*t	|dd�}�8y)z>
    Add a proxy attribute 'name' to src with targets dst
    r5zsrc object has no _attrMap�rN)rnr^rrfr6)rcr+rrr#�dstr\r]�D�DV�drWrS�attr�dAs               r�addProxyAttributer|�s���
�3�z�"�@�$@�@�"��C��"�E�A�r���:�S�T�s�
�A�	�B�
�.����8��Q�4��1�2��q�A�&�s�1�-�	��T����Z��-�B�.r)r)NNNN)�__version__r�reportlab.lib.validatorsrr�reportlab.lib.utilsr�	reportlabrrrr:r3rYr^rfrsr|rrr�<module>r�s[��
��	��4>�%��	/�	/�\�\�,�d��>)#�V%�	�n�.r

Zerion Mini Shell 1.0