관리-도구
편집 파일: utils.cpython-37.opt-1.pyc
B ��]g � @ s d Z ddlmZ ddlZddlZddlZejd dkZddlm Z er\ddl mZ eZ eZn(ddlZe�de� ddlmZ dd � Z d d� ZddlmZ d/dd�Zdd� Zd0dd�Zdd� Zdd� Zdd� Zd1dd�ZG dd� de�Zd2d d!�Zd"d#d$d%d&d'd(�Z d)d*� Z!d+d,� Z"d-d.� Z#dS )3z� .. autofunction:: rgb .. autofunction:: iterflatlist .. autofunction:: strlist .. autofunction:: get_unit .. autofunction:: split_coordinate .. autofunction:: split_angle .. autofunction:: rect_top_left_corner .. autofunction:: pretty_xml � )�unicode_literalsN� )�partial)�urlopenz1Python 2 support will be dropped with version 1.4c C s t | t�rt| dd�S t| �S )N�utf8)�encoding)� isinstance�strZunicode)�value� r �?/opt/alt/python37/lib/python3.7/site-packages/svgwrite/utils.py� to_unicode, s r c C s t | t�S )N)r � basestring)r r r r � is_string1 s r )�pattern�RGBc C sl dd� }|� � dkr:dt| �d@ t|�d@ t|�d@ f S |dkr\d|| �||�||�f S td| ��d S ) 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 S s$ t | �} | dk rd} | dkr d} | S )Nr �d )�float)r r r r �percentJ s zrgb.<locals>.percentr z rgb(%d,%d,%d)� �%zrgb(%d%%,%d%%,%d%%)zInvalid mode '%s'N)�upper�int� ValueError)�r�g�b�moder r r r �rgb7 s &r c c sD x>| D ]6}t |d�r6t|�s6xt|�D ] }|V q&W q|V qW dS )z: Flatten nested *values*, returns an `iterator`. �__iter__N)�hasattrr �iterflatlist)�values�element�itemr r r r! \ s r! �,c C s( t | �r| S |�dd� t| �D ��S dS )z� Concatenate **values** with **sepertator**, `None` values will be excluded. :param values: `iterable` object :returns: `string` c S s g | ]}|d k rt |��qS )N)r )�.0r r r r � <listcomp>t s zstrlist.<locals>.<listcomp>N)r �joinr! )r"