Hacked By AnonymousFox
�
�܋f� � � � d Z ddlZddlmZ ddlmZ d� Zdd�Zd� Zdd
�Z d� Z
d� Zd
� Zd d�Z
G d� de� � Zd!d�Zddddddd�Zd� Zd� Zd� ZdS )"z�
.. autofunction:: rgb
.. autofunction:: iterflatlist
.. autofunction:: strlist
.. autofunction:: get_unit
.. autofunction:: split_coordinate
.. autofunction:: split_angle
.. autofunction:: rect_top_left_corner
.. autofunction:: pretty_xml
� N)�Path)�patternc �, � t | t � � S �N)�
isinstance�str��values �_/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/svgwrite/utils.py� is_stringr s � ��e�S�!�!�!� �RGBc � � d� }|� � � dk r8dt | � � dz t |� � dz t |� � dz fz S |dk r#d || � � ||� � ||� � fz S t d|z � � �)aM
Convert **r**, **g**, **b** values to a `string`.
:param r: red part
:param g: green part
:param b: blue part
:param string mode: ``'RGB | %'``
:rtype: string
========= =============================================================
mode Description
========= =============================================================
``'RGB'`` returns a rgb-string format: ``'rgb(r, g, b)'``
``'%'`` returns percent-values as rgb-string format: ``'rgb(r%, g%, b%)'``
========= =============================================================
c �D � t | � � } | dk rd} | dk rd} | S )Nr �d )�floatr s r �percentzrgb.<locals>.percent8 s. � ��e�����1�9�9��E��3�;�;��E��r
r z
rgb(%d,%d,%d)� �%zrgb(%d%%,%d%%,%d%%)zInvalid mode '%s')�upper�int�
ValueError)�r�g�b�moder s r �rgbr $ s� � �(� � � �z�z�|�|�u����#�a�&�&�3�,��A�����c�!�f�f�s�l�!K�K�K�
���� %����
�
�G�G�A�J�J����
�
�'K�K�K��,�t�3�4�4�4r
c # � K � | D ]<}t |d� � r&t |� � st |� � D ]}|V � ��8|V � �=dS )z:
Flatten nested *values*, returns an `iterator`.
�__iter__N)�hasattrr �iterflatlist)�values�element�items r r! r! J sv � � � �
� � ���7�J�'�'� � �'�0B�0B� �$�W�-�-�
�
���
�
�
�
�
� �M�M�M�M�� r
�,c �| � t | � � r| S |� d� t | � � D � � � � S )z�
Concatenate **values** with **sepertator**, `None` values will be excluded.
:param values: `iterable` object
:returns: `string`
c �0 � g | ]}|�t |� � ��S r )r )�.0r
s r �
<listcomp>zstrlist.<locals>.<listcomp>b s# � �a�a�a�e�u�O`�s�5�z�z�O`�O`�O`r
)r �joinr! )r"