관리-도구
편집 파일: base.cpython-37.opt-1.pyc
B ��] � @ s| d Z ddlmZ ddlZddlmZ ddlmZmZm Z G dd� de �ZG dd � d e �ZG d d� de�Z G dd � d e�ZdS )z7 The **BaseElement** is the root for all SVG elements. � )�etreeN)� Parameter)�AutoID� to_unicode�PYTHON3c @ s� e Zd ZdZdZdd� Zdd� Zdd� Zed d � �Z edd� �Z ed d� �Zejdd� �Zedd� �Z dd� Zd/dd�Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd0d+d,�Zd-d.� ZdS )1�BaseElementz� The **BaseElement** is the root for all SVG elements. The SVG attributes are stored in **attribs**, and the SVG subelements are stored in **elements**. ZbaseElementc K s| |� dd�}|dk r|j| _nt� | _|� dd�}|dk rB|| j_|� dd�}|dk r^|| j_t� | _| �|� t� | _ dS )a� :param extra: extra SVG attributes (keyword arguments) * add trailing '_' to reserved keywords: ``'class_'``, ``'from_'`` * replace inner '-' by '_': ``'stroke_width'`` SVG attribute names will be checked, if **debug** is `True`. workaround for removed **attribs** parameter in Version 0.2.2:: # replace element = BaseElement(attribs=adict) #by element = BaseElement() element.update(adict) �factoryN�debug�profile) �pop� _parameterr r r �dict�attribs�update�list�elements)�selfZextrar r r � r �>/opt/alt/python37/lib/python3.7/site-packages/svgwrite/base.py�__init__ s zBaseElement.__init__c C s8 x2|� � D ]&\}}|�d��dd�}| �||� q W dS )z� Update SVG Attributes from `dict` attribs. Rules for keys: 1. trailing '_' will be removed (``'class_'`` -> ``'class'``) 2. inner '_' will be replaced by '-' (``'stroke_width'`` -> ``'stroke-width'``) �_�-N)�items�rstrip�replace�__setitem__)r r �key�valuer r r r H s zBaseElement.updatec C s@ t � | �}t � | j�|_t � | j�|_d|jkr<|�� |d<