/opt/alt/python27/lib/python2.7/site-packages/svgwrite
Edit: /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyo (7544B)
Ñò
J^oRc @ sÙ d Z d d k Z e i d d j Z d d k l Z e o e Z e Z n
d „ Z d „ Z d d k
l Z d d d d d
„ Z d „ Z
d d
„ Z d „ Z d „ Z d „ Z d d „ Z d e f d „ ƒ YZ d S( sÛ
.. autofunction:: rgb
.. autofunction:: iterflatlist
.. autofunction:: strlist
.. autofunction:: get_unit
.. autofunction:: split_coordinate
.. autofunction:: split_angle
.. autofunction:: rect_top_left_corner
iÿÿÿÿNi i ( t partialc C s+ t | t ƒ o t | d d ƒSt | ƒ S( Nt encodingt utf8( t
isinstancet strt unicode( t value( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt
to_unicode" s c C s
t | t ƒ S( N( R t
basestring( R ( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt is_string' s ( t patternt RGBc C s‘ d „ } | i ƒ d j o0 d t | ƒ d @t | ƒ d @t | ƒ d @f S| d j o$ d | | ƒ | | ƒ | | ƒ f St d | ƒ ‚ d S( sM
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 | ƒ } | d j o
d } n | d j o
d } n | S( Ni id ( t int( R ( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt percent@ s
R s
rgb(%d,%d,%d)iÿ t %s rgb(%d%%,%d%%,%d%%)s Invalid mode '%s'N( t upperR t
ValueError( t rt gt bt modeR
( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt rgb- s 0
$c c sX xQ | D]I } t | d ƒ o. t | ƒ o x" t | ƒ D] } | Vq8 Wq | Vq Wd S( s:
Flatten nested *values*, returns an `iterator`.
t __iter__N( t hasattrR t iterflatlist( t valuest elementt item( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyR Q s
t ,c C s[ t | ƒ o | S| i g } t | ƒ D]$ } | d j o | t | ƒ q) q) ~ ƒ Sd S( s“
Concatenate **values** with **sepertator**, `None` values will be excluded.
:param values: `iterable` object
:returns: `string`
N( R t joinR t NoneR ( R t seperatort _[1]R ( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt strlist] s
c C sV t | t t f ƒ o d St i i | ƒ } | o | i d ƒ St d | ƒ ‚ d S( sŠ
Get the `unit` identifier of **coordinate**, if **coordinate** has a valid
`unit` identifier appended, else returns `None`.
i s Invalid format: '%s'N( R R t floatR R
t
coordinatet matcht groupR ( R# t result( ( s? /opt/alt/python27/lib/python2.7/site-packages/svgwrite/utils.pyt get_unitj s c C sw t | t t f ƒ o t | ƒ d f St i i | ƒ } | o# t | i d ƒ ƒ | i d ƒ f St d | ƒ ‚ d S( sÐ
Split coordinate into `
` and 'unit` identifier.
:returns: <2-tuple> (number, unit-identifier) or (number, None) if no unit-identifier
is present or coordinate is an int or float.
i i s Invalid format: '%s'N( R R R" R R
R# R$ R% R ( R# R&