%PDF- %PDF-
Direktori : /lib/python3/dist-packages/reportlab/lib/__pycache__/ |
Current File : //lib/python3/dist-packages/reportlab/lib/__pycache__/attrmap.cpython-312.pyc |
� C��e � � � d Z dZddlmZmZ ddlmZ ddlmZ G d� d� Z G d� d � Z G d � de� Zd� 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 � � e Zd ZdZd� Zd� Zy)� CallableValuez(a class to allow callable initial valuesc �. � || _ || _ || _ y �N��func�args�kw)�selfr r r s �7/usr/lib/python3/dist-packages/reportlab/lib/attrmap.py�__init__zCallableValue.__init__% s � ��� ��� ���� c �N � | j | j i | j ��S r r )r s r �__call__zCallableValue.__call__+ s � ��t�y�y�$�)�)�.�d�g�g�.�.r N)�__name__� __module__�__qualname__�__doc__r r � r r r r # s � �2��/r r c �$ � e Zd ZdZdd�Zd� Zd� Zy)�AttrMapValuez,Simple multi-value holder for attribute mapsNc � � |xs t | _ || _ || _ || _ |j � D ] \ }}t | ||� � y r )r �validate�desc�_initial�_advancedUsage�items�setattr)r r r �initial� advancedUsager �k�vs r r zAttrMapValue.__init__0 sI � � �.�J�� ��� ��� �+����8�8�:� �C�A�a��D��1�� r c � � |dk( r6t | j t � r| j � S | j S |dk( ryt |� �)Nr# �hiddenr )� isinstancer r �AttributeError)r �names r �__getattr__zAttrMapValue.__getattr__8 sA � ���?��$�-�-� �6�t�}�}��8N��=�=� � �8�^���T�"�"r c � � ddj | j j � D �cg c] }d|z �� c}� z S c c}w )NzAttrMapValue(%s)z, z%s=%r)�join�__dict__r! )r �is r �__repr__zAttrMapValue.__repr__A s5 � �!�D�I�I�D�M�M�DW�DW�DY�.Z�q�w��{�.Z�$[�[�[��.Zs �> )NNNr )r r r r r r, r1 r r r r r . s � �6��#�\r r c �( � e Zd Zdg fd�Zd� Zg fd�Zy)�AttrMapNc �D � i }|rdt |t � r|}nQt |� s|f}|D ]>