AlkantarClanX12

Your IP : 3.133.129.8


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/svgwrite/__pycache__/validator2.cpython-311.pyc

�

�܋f=��t�ddlmZddlmZddlmZiZd�Zdd�ZGd�de��ZGd	�d
e��Z	dS)
�)�full11)�tiny12)�patternc�@�t|��t|��zS�N)�str)�profile�debugs  �d/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/svgwrite/validator2.py�	cache_keyrs���w�<�<�#�e�*�*�$�$�Tc��	tt||��S#t$rY|dkrt|��}n&|dvrt	|��}ntd|z���|tt||��<|cYSwxYw)z Validator factory �tiny)�full�basic�nonezUnsupported profile: '%s')�validator_cacher�KeyError�Tiny12Validator�Full11Validator�
ValueError)r	r
�	validators   r�
get_validatorrs���
��y��%�8�8�9�9�������f���'��.�.�I�I�
�1�
1�
1�'��.�.�I�I��8�7�B�C�C�C�5>��	�'�5�1�1�2��������s��A B�?Bc�h�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	dd
�Z
d�Zd�Zd
�Z
d�Zd�Zd�ZeZdS)rzTiny 1.2Tc��||_tj|_tj|_tj��|_dSr)r
r�
attributes�elements�TypeChecker�typechecker��selfr
s  r�__init__zTiny12Validator.__init__&�3����
� �+������
�!�-�/�/����r
c�h�|���D]\}}|�|||���dS)z�
        Check if attributes are valid for object 'elementname' and all svg
        attributes have valid types and values.

        Raises ValueError.
        N)�items�check_svg_attribute_value)r!�elementnamer�
attributename�values     r�check_all_svg_attribute_valuesz.Tiny12Validator.check_all_svg_attribute_values,sM��%/�$4�$4�$6�$6�	N�	N� �M�5��*�*�;�
�u�M�M�M�M�	N�	Nr
c�`�|�||��|�|||��dS)z�
        Check if 'attributename' is valid for object 'elementname' and 'value'
        is a valid svg type and value.

        Raises ValueError.
        N)�_check_valid_svg_attribute_name�_check_svg_value)r!r'r(r)s    rr&z)Tiny12Validator.check_svg_attribute_value6s8��	
�,�,�[�-�H�H�H����k�=�%�@�@�@�@�@r
c	�
�|j|}|�|��D] }|j�||��rdS�!t	|��}||�|��vrt
d|�d|�d|�d����dS)z�
        Checks if 'value' is a valid svg-type for svg-attribute
        'attributename' at svg-element 'elementname'.

        Raises TypeError.
        N�'z&' is not a valid value for attribute 'z' at svg-element <�>.)r�	get_typesr�checkr�	get_const�	TypeError)r!r'r(r)�	attribute�typename�valuestrs       rr-z Tiny12Validator._check_svg_value@s����O�M�2�	�!�+�+�K�8�8�	�	�H���%�%�h��6�6�
����
��u�:�:���9�.�.�{�;�;�;�;��)�ch�ch�ch�jw�jw�jw�zE�zE�zE�F�G�G�
G�<�;r
c�^�|�||��std|�d|�d����dS)z~ Check if 'attributename' is a valid svg-attribute for svg-element
        'elementname'.

        Raises ValueError.
        zInvalid attribute '�' for svg-element <r0N)�is_valid_svg_attributer)r!r'r(s   rr,z/Tiny12Validator._check_valid_svg_attribute_nameQsI���*�*�;�
�F�F�	l��*�}�}�}�^i�^i�^i�j�k�k�k�	l�	lr
c�p�	|j|S#t$rtd|�d|j�d����wxYw)N�<z&> is not valid for selected profile: '�'.)rr�profilename�r!r's  r�_get_elementzTiny12Validator._get_elementZsW��	n��=��-�-���	n�	n�	n��(�k�k�k�[_�[k�[k�[k�l�m�m�m�	n���s��&5�stringc�f�|j�||��r|St|�d|�d����)zZ
        Check if 'value' matches svg type 'typename'.

        Raises TypeError.
        z is not of type 'r=)rr2r4�r!r)r6s   r�check_svg_typezTiny12Validator.check_svg_type`s@����!�!�(�E�2�2�	K��L��������I�J�J�Jr
c�8�|j�||��Sr)rr2rCs   r�is_valid_svg_typez!Tiny12Validator.is_valid_svg_typeks����%�%�h��6�6�6r
c��||jvS)z4 True if 'elementname' is a valid svg-element name. )rr?s  r�is_valid_elementnamez$Tiny12Validator.is_valid_elementnamens���d�m�+�+r
c�>�|�|��}||jvS)za True if 'attributename' is a valid svg-attribute for svg-element
        'elementname'.
        )r@�valid_attributes)r!r'r(�elements    rr:z&Tiny12Validator.is_valid_svg_attributers%���#�#�K�0�0���� 8�8�8r
c�>�|�|��}||jvS)zf True if svg-element 'childrenname' is a valid children of
        svg-element 'elementname'.
        )r@�valid_children)r!r'�childrennamerKs    r�is_valid_childrenz!Tiny12Validator.is_valid_childrenys%���#�#�K�0�0���w�5�5�5r
c�^�|�||��std|�d|�d����dS)z� Checks if svg-element 'childrenname' is a valid children of
        svg-element 'elementname'.

        Raises ValueError.
        zInvalid children 'r9r0N)rOr)r!r'rNs   r�check_valid_childrenz$Tiny12Validator.check_valid_children�sI���%�%�k�<�@�@�	j��*�l�l�l�\g�\g�\g�h�i�i�i�	j�	jr
c���|�td���t|ttf��r|df}nqtj�|�����}|r(|���\}}}t|��}ntd|z���||f}|j
�|d��r|Sd|j
���z}t|�d|�d����)zk Split value in (number, unit) if value has an unit or (number, None).

        Raises ValueError.
        NzInvalid type 'None'.z#'%s' is not a valid svg-coordinate.rz	SVG %s %sz is not a valid number for: �.)
r4�
isinstance�int�floatr�
coordinate�match�strip�groupsrr�	is_number�get_version)r!r)�result�number�tmp�unit�versions       r�get_coordinatezTiny12Validator.get_coordinate�s����=��2�3�3�3��e�c�5�\�*�*�		$��T�]�F�F��'�-�-�e�k�k�m�m�<�<�F��
P�$*�M�M�O�O�!���T��v����� �!F��!N�O�O�O��d�^�F���%�%�f�Q�i�0�0�	U��M�!�D�$4�$@�$@�$B�$B�B�G��E�E�E�7�7�7�S�T�T�Tr
N�T)rA)�__name__�
__module__�__qualname__r>r"r*r&r-r,r@rDrFrHr:rOrQrb�
get_length�r
rrr#s�������K�0�0�0�0�N�N�N�A�A�A�G�G�G�"l�l�l�n�n�n�	K�	K�	K�	K�7�7�7�,�,�,�9�9�9�6�6�6�j�j�j�U�U�U�. �J�J�Jr
rc��eZdZdZdd�ZdS)rzFull 1.1Tc��||_tj|_tj|_tj��|_dSr)r
rrrrrr s  rr"zFull11Validator.__init__�r#r
Nrc)rdrerfr>r"rhr
rrr�s-�������K�0�0�0�0�0�0r
rNrc)
�
svgwrite.datarrrrrr�objectrrrhr
r�<module>rms���!� � � � � � � � � � � �!�!�!�!�!�!���%�%�%�����} �} �} �} �} �f�} �} �} �@0�0�0�0�0�o�0�0�0�0�0r