• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.is_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中svgwrite.utils.is_string函数的典型用法代码示例。如果您正苦于以下问题:Python is_string函数的具体用法?Python is_string怎么用?Python is_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了is_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: is_frequency

 def is_frequency(self, value):
     #frequency ::= number (~"Hz" | ~"kHz")
     if self.is_number(value):
         return True
     elif is_string(value):
         return pattern.frequency.match(value.strip()) is not None
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:7,代码来源:typechecker.py


示例2: is_percentage

 def is_percentage(self, value):
     #percentage ::= number "%"
     if self.is_number(value):
         return True
     elif is_string(value):
         return pattern.percentage.match(value.strip()) is not None
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:7,代码来源:typechecker.py


示例3: __init__

 def __init__(self, inherit=None, **extra):
     super(_AbstractGradient, self).__init__(**extra)
     if inherit is not None:
         if is_string(inherit):
             self.set_href(inherit)
         else:
             self.set_href(inherit.get_iri())
开发者ID:MindPass,项目名称:Code,代码行数:7,代码来源:gradients.py


示例4: is_time

 def is_time(self, value):
     #time ::= <number> (~"ms" | ~"s")?
     if self.is_number(value):
         return True
     elif is_string(value):
         return pattern.time.match(value.strip()) is not None
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:7,代码来源:typechecker.py


示例5: split

 def split(value):
     #TODO: improve split function!!!!
     if isinstance(value, (int, float)):
         return (value, )
     if is_string(value):
         return iterflatlist(v.split(',') for v in value.split(' '))
     return value
开发者ID:MichelMina,项目名称:Wx,代码行数:7,代码来源:typechecker.py


示例6: set_markers

    def set_markers(self, markers):
        """
        Set markers for line elements (line, polygon, polyline, path) to
        values specified by  `markers`.

        * if `markers` is a 3-tuple:

          * attribute 'marker-start' = markers[0]
          * attribute 'marker-mid' = markers[1]
          * attribute 'marker-end' = markers[2]

        * `markers` is a `string` or a `Marker` class:

          * attribute 'marker' = `FuncIRI` of markers

        """
        def get_funciri(value):
            if is_string(value):
                # strings has to be a valid reference including the '#'
                return 'url(%s)' % value
            else:
                # else create a reference to the object '#id'
                return 'url(#%s)' % value['id']

        if is_string(markers):
            self['marker'] = get_funciri(markers)
        else:
            try:
                markerstart, markermid, markerend = markers
                self['marker-start'] = get_funciri(markerstart)
                self['marker-mid'] = get_funciri(markermid)
                self['marker-end'] = get_funciri(markerend)
            except (TypeError, KeyError):
                self['marker'] = get_funciri(markers)
开发者ID:MindPass,项目名称:Code,代码行数:34,代码来源:mixins.py


示例7: get_funciri

 def get_funciri(value):
     if is_string(value):
         # strings has to be a valid reference including the '#'
         return 'url(%s)' % value
     else:
         # else create a reference to the object '#id'
         return 'url(#%s)' % value['id']
开发者ID:MindPass,项目名称:Code,代码行数:7,代码来源:mixins.py


示例8: __init__

    def __init__(self, start=None, size=None, resolution=None, inherit=None, **extra):
        """
        :param 2-tuple start: defines the start point of the filter effects region (**x**, **y**)
        :param 2-tuple size: defines the size of the filter effects region (**width**, **height**)
        :param resolution: takes the form ``'x-pixels [y-pixels]'``, and indicates
            the width and height of the intermediate images in pixels.
        :param inherit: inherits properties from Filter `inherit` see: **xlink:href**

        """
        super(Filter, self).__init__(**extra)
        if start is not None:
            self['x'] = start[0]
            self['y'] = start[1]
        if size is not None:
            self['width'] = size[0]
            self['height'] = size[1]
        if resolution is not None:
            if is_string(resolution):
                self['filterRes'] = resolution
            elif hasattr(resolution, '__iter__'):
                self['filterRes'] = strlist(resolution, ' ')
            else:
                self['filterRes'] = str(resolution)

        if inherit is not None:
            self.href = inherit
            self.update_id()
开发者ID:VR4ALL,项目名称:cardboard_goggles,代码行数:27,代码来源:filters.py


示例9: is_angle

 def is_angle(self, value):
     #angle ::= number (~"deg" | ~"grad" | ~"rad")?
     if self.is_number(value):
         return True
     elif is_string(value):
         return pattern.angle.match(value.strip()) is not None
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:7,代码来源:typechecker.py


示例10: __init__

    def __init__(self, text, insert=None, x=[], y=[], dx=[], dy=[], rotate=[],
                 **extra):
        """
        :param string text: **tspan** content
        :param 2-tuple insert: The **insert** parameter is the absolute insert point
                               of the text, don't use this parameter in combination
                               with the **x** or the **y** parameter.
        :param list x: list of absolute x-axis values for characters
        :param list y: list of absolute y-axis values for characters
        :param list dx: list of relative x-axis values for characters
        :param list dy: list of relative y-axis values for characters
        :param list rotate: list of rotation-values for characters (in degrees)

        """
        super(TSpan, self).__init__(**extra)
        self.text = text
        if insert is not None:
            if is_string(insert):
                raise TypeError("'insert' should be a <tuple> or a <list>  with" \
                                " at least two elements.")
            if x or y:
                raise ValueError("Use 'insert' and 'x' or 'y' parameter not" \
                                 " at the same time!")
            x = [insert[0]]
            y = [insert[1]]

        if x: self['x'] = strlist(list(iterflatlist(x)), ' ')
        if y: self['y'] = strlist(list(iterflatlist(y)), ' ')
        if dx: self['dx'] = strlist(list(iterflatlist(dx)), ' ')
        if dy: self['dy'] = strlist(list(iterflatlist(dy)), ' ')
        if rotate: self['rotate'] = strlist(list(iterflatlist(rotate)), ' ')
开发者ID:behnam,项目名称:typefacet,代码行数:31,代码来源:text.py


示例11: update_id

 def update_id(self):
     if not hasattr(self, 'href'):
         return
     if is_string(self.href):
         idstr = self.href
     else:
         idstr = self.href.get_iri()
     self.attribs['xlink:href'] = idstr
开发者ID:MindPass,项目名称:Code,代码行数:8,代码来源:mixins.py


示例12: iterflatlist

def iterflatlist(values):
    """ Flatten nested *values*, returns an *iterator*. """
    for element in values:
        if hasattr(element, "__iter__") and not is_string(element):
            for item in iterflatlist(element):
                yield item
        else:
            yield element
开发者ID:MichelMina,项目名称:Wx,代码行数:8,代码来源:typechecker.py


示例13: is_IRI

 def is_IRI(self, value):
     # Internationalized Resource Identifiers
     # a more generalized complement to Uniform Resource Identifiers (URIs)
     # nearly everything can be a valid <IRI>
     # only a none-empty string ist a valid input
     if is_string(value):
         return bool(value.strip())
     else:
         return False
开发者ID:MichelMina,项目名称:Wx,代码行数:9,代码来源:typechecker.py


示例14: is_length

 def is_length(self, value):
     #length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
     if value is None:
         return False
     if isinstance(value, (int, float)):
         return self.is_number(value)
     elif is_string(value):
         result = pattern.length.match(value.strip())
         if result:
             number, tmp, unit = result.groups()
             return self.is_number(number) # for tiny check!
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:12,代码来源:typechecker.py


示例15: fill

    def fill(self, color=None, rule=None, opacity=None):
        """
        Set SVG Properties **fill**, **fill-rule** and **fill-opacity**.

        """
        if color:
            if is_string(color):
                self['fill'] = color
            else:
                self['fill'] = color.get_paint_server()
        if rule:
            self['fill-rule'] = rule
        if opacity:
            self['fill-opacity'] = opacity
        return self
开发者ID:MindPass,项目名称:Code,代码行数:15,代码来源:mixins.py


示例16: is_number_optional_number

 def is_number_optional_number(self, value):
     #number-optional-number ::= number
     #                           | number comma-wsp number
     if is_string(value):
         values = re.split(' *,? *', value.strip())
         if 0 < len(values) < 3: # 1 or 2 numbers
             for v in values:
                 if not self.is_number(v):
                     return False
             return True
     else:
         try: # is it a 2-tuple
             n1, n2 = value
             if self.is_number(n1) and \
                self.is_number(n2):
                 return True
         except TypeError: # just one value
             return self.is_number(value)
         except ValueError: # more than 2 values
             pass
     return False
开发者ID:MichelMina,项目名称:Wx,代码行数:21,代码来源:typechecker.py


示例17: __init__

    def __init__(self, insert=None, size=None, inherit=None, **extra):
        """
        :param 2-tuple insert: base point of the pattern (**x**, **y**)
        :param 2-tuple size: size of the pattern (**width**, **height**)
        :param inherit: pattern inherits properties from `inherit` see: **xlink:href**

        """
        super(Pattern, self).__init__(**extra)
        if insert is not None:
            self['x'] = insert[0]
            self['y'] = insert[1]
        if size is not None:
            self['width'] = size[0]
            self['height'] = size[1]
        if inherit is not None:
            if is_string(inherit):
                self.set_href(inherit)
            else:
                self.set_href(inherit.get_iri())

        if self.debug:
            self.validator.check_all_svg_attribute_values(self.elementname, self.attribs)
开发者ID:behnam,项目名称:typefacet,代码行数:22,代码来源:pattern.py


示例18: set_value

    def set_value(self, values, calcMode=None, keyTimes=None, keySplines=None,
                  from_=None, to=None, by=None):
        """
        Set animation attributes :ref:`values`, :ref:`calcMode`, :ref:`keyTimes`,
        :ref:`keySplines`, :ref:`from`, :ref:`to` and :ref:`by`.
        """
        if values is not None:
            if not is_string(values):
                values = strlist(values, ';')
            self['values'] = values

        if calcMode is not None:
            self['calcMode'] = calcMode
        if keyTimes is not None:
            self['keyTimes'] = keyTimes
        if keySplines is not None:
            self['keySplines'] = keySplines
        if from_ is not None:
            self['from'] = from_
        if to is not None:
            self['to'] = to
        if by is not None:
            self['by'] = by
开发者ID:MindPass,项目名称:Code,代码行数:23,代码来源:animate.py


示例19: stroke

    def stroke(self, color=None, width=None, opacity=None, linecap=None,
               linejoin=None, miterlimit=None):
        """
        Set SVG Properties **stroke**, **stroke-width**, **stroke-opacity**,
        **stroke-linecap** and **stroke-miterlimit**.

        """

        if color:
            if is_string(color):
                self['stroke'] = color
            else:
                self['stroke'] = color.get_paint_server()
        if width:
            self['stroke-width'] = width
        if opacity:
            self['stroke-opacity'] = opacity
        if linecap:
            self['stroke-linecap'] = linecap
        if linejoin:
            self['stroke-linejoin'] = linejoin
        if miterlimit:
            self['stroke-miterlimit'] = miterlimit
        return self
开发者ID:MindPass,项目名称:Code,代码行数:24,代码来源:mixins.py


示例20: is_transform_list

 def is_transform_list(self, value):
     if is_string(value):
         return is_valid_transferlist(value)
     else:
         return False
开发者ID:MichelMina,项目名称:Wx,代码行数:5,代码来源:typechecker.py



注:本文中的svgwrite.utils.is_string函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python validator2.get_validator函数代码示例发布时间:2022-05-27
下一篇:
Python svgwrite.rgb函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap