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

Python model.SimpleModel类代码示例

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

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



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

示例1: __new__

    def __new__(cls, *args, **kwargs):
        assert len(args) <= 2

        if len(args) >= 1 and args[0] is not None:
            kwargs['total_digits'] = args[0]
            kwargs['fraction_digits'] = 0
            if len(args) == 2 and args[1] is not None:
                kwargs['fraction_digits'] = args[1]
                assert args[0] > 0, "'total_digits' must be positive."
                assert args[1] <= args[0], "'total_digits' must be greater than" \
                                          " or equal to 'fraction_digits'." \
                                          " %r ! <= %r" % (args[1], args[0])

            # + 1 for decimal separator
            # + 1 for negative sign
            msl = kwargs.get('max_str_len', None)
            if msl is None:
                kwargs['max_str_len'] = (cls.Attributes.total_digits +
                                             cls.Attributes.fraction_digits + 2)
            else:
                kwargs['max_str_len'] = msl

        retval = SimpleModel.__new__(cls,  ** kwargs)

        return retval
开发者ID:jrocnuck,项目名称:spyne,代码行数:25,代码来源:primitive.py


示例2: validate_string

 def validate_string(cls, value):
     return (     SimpleModel.validate_string(cls, value)
         and (value is None or (
                 len(value) >= cls.Attributes.min_len
             and len(value) <= cls.Attributes.max_len
             and _re_match_with_span(cls.Attributes, value)
         )))
开发者ID:anthonyrisinger,项目名称:spyne,代码行数:7,代码来源:primitive.py


示例3: is_default

 def is_default(cls):
     return (    SimpleModel.is_default(cls)
             and cls.Attributes.gt == Decimal.Attributes.gt
             and cls.Attributes.ge == Decimal.Attributes.ge
             and cls.Attributes.lt == Decimal.Attributes.lt
             and cls.Attributes.le == Decimal.Attributes.le
         )
开发者ID:anthonyrisinger,项目名称:spyne,代码行数:7,代码来源:primitive.py


示例4: is_default

 def is_default(cls):
     return (
         SimpleModel.is_default(cls)
         and cls.Attributes.min_len == Unicode.Attributes.min_len
         and cls.Attributes.max_len == Unicode.Attributes.max_len
         and cls.Attributes.pattern == Unicode.Attributes.pattern
     )
开发者ID:rstuart,项目名称:spyne,代码行数:7,代码来源:primitive.py


示例5: validate_string

 def validate_string(cls, value):
     return SimpleModel.validate_string(cls, value) and (
         value is None or (
             len(value) <= (cls.Attributes.total_digits +
                                          cls.Attributes.fraction_digits + 1)
                                               # + 1 is for decimal separator
         ))
开发者ID:tlandschoff-scale,项目名称:spyne,代码行数:7,代码来源:primitive.py


示例6: __new__

    def __new__(cls, dim=None, **kwargs):
        assert dim in (None,2,3)
        if dim is not None:
            kwargs['dim'] = dim
            kwargs['pattern'] = _get_point_pattern(dim)
            kwargs['type_name'] = 'point%dd' % dim

        return SimpleModel.__new__(cls,  ** kwargs)
开发者ID:tlandschoff-scale,项目名称:spyne,代码行数:8,代码来源:primitive.py


示例7: validate_string

 def validate_string(cls, value):
     return (     SimpleModel.validate_string(cls, value)
         and (value is None or (
                 len(value) >= cls.Attributes.min_len
             and len(value) <= cls.Attributes.max_len
             and (cls.Attributes.pattern is None or
                         re.match(cls.Attributes.pattern, value) is not None)
             )))
开发者ID:Juspeczyk,项目名称:spyne,代码行数:8,代码来源:primitive.py


示例8: validate_native

 def validate_native(cls, value):
     return SimpleModel.validate_native(cls, value) and (
         value is None or (
             value >  cls.Attributes.gt and
             value >= cls.Attributes.ge and
             value <  cls.Attributes.lt and
             value <= cls.Attributes.le
         ))
开发者ID:anthonyrisinger,项目名称:spyne,代码行数:8,代码来源:primitive.py


示例9: __new__

    def __new__(cls, *args, **kwargs):
        assert len(args) <= 1

        if len(args) == 1:
            kwargs['max_len'] = args[0]

        retval = SimpleModel.__new__(cls,  ** kwargs)

        return retval
开发者ID:anthonyrisinger,项目名称:spyne,代码行数:9,代码来源:primitive.py


示例10: __new__

    def __new__(cls, dim=None, **kwargs):
        assert dim in (None,2,3)
        if dim is not None:
            kwargs['dim'] = dim
            kwargs['pattern'] = _get_multipolygon_pattern(dim)
            kwargs['type_name'] = 'multipolygon%dd' % dim

        retval = SimpleModel.__new__(cls, **kwargs)
        retval.__namespace__ = 'http://spyne.io/schema'
        return retval
开发者ID:KetothXupack,项目名称:spyne,代码行数:10,代码来源:primitive.py


示例11: validate_native

 def validate_native(cls, value):
     if value is not None and isinstance(value, datetime.datetime):
         value = value.replace(tzinfo=pytz.utc)
     return SimpleModel.validate_native(cls, value) and (
         value is None or (
             value >  cls.Attributes.gt and
             value >= cls.Attributes.ge and
             value <  cls.Attributes.lt and
             value <= cls.Attributes.le
         ))
开发者ID:esauro,项目名称:spyne,代码行数:10,代码来源:primitive.py


示例12: validate_native

 def validate_native(cls, value):
     if isinstance(value, datetime.datetime) and value.tzinfo is None:
         value = value.replace(tzinfo=spyne.LOCAL_TZ)
     return SimpleModel.validate_native(cls, value) and (
         value is None or (
                 value >  cls.Attributes.gt
             and value >= cls.Attributes.ge
             and value <  cls.Attributes.lt
             and value <= cls.Attributes.le
         ))
开发者ID:jrocnuck,项目名称:spyne,代码行数:10,代码来源:primitive.py


示例13: validate_native

 def validate_native(cls, value):
     if isinstance(value, datetime.datetime) and value.tzinfo is None:
         value = value.replace(tzinfo=spyne.LOCAL_TZ)
     return SimpleModel.validate_native(cls, value) and (
         value is None or (
             # min_dt is also a valid value if gt is intact.
                 (cls.Attributes.gt is None or value > cls.Attributes.gt)
             and value >= cls.Attributes.ge
             # max_dt is also a valid value if lt is intact.
             and (cls.Attributes.lt is None or value < cls.Attributes.lt)
             and value <= cls.Attributes.le
         ))
开发者ID:plq,项目名称:spyne,代码行数:12,代码来源:datetime.py


示例14: __new__

    def __new__(cls, dim=None, **kwargs):
        assert dim in (None, 2, 3)
        if dim is not None:
            kwargs["dim"] = dim
            kwargs["pattern"] = _get_multipolygon_pattern(dim)
            kwargs["type_name"] = "multipolygon%dd" % dim

        retval = SimpleModel.__new__(cls, **kwargs)
        retval.__namespace__ = "http://spyne.io/schema"
        retval.__extends__ = Unicode
        retval.__orig__ = Unicode
        return retval
开发者ID:rstuart,项目名称:spyne,代码行数:12,代码来源:primitive.py


示例15: __new__

    def __new__(cls, **kwargs):
        if 'encoding' in kwargs:
            v = kwargs['encoding']

            if v in (None, 'base64'):
                kwargs['type_name'] = 'base64Binary'
            elif v == 'hex':
                kwargs['type_name'] = 'hexBinary'
            else:
                raise ValueError("'encoding' must be one of: %r" % \
                                (tuple(ByteArray._encoding.handlers.values()),))


        return SimpleModel.__new__(cls, **kwargs)
开发者ID:amgibson,项目名称:spyne,代码行数:14,代码来源:binary.py


示例16: __new__

    def __new__(cls, *args, **kwargs):
        assert len(args) <= 2

        if len(args) >= 1 and args[0] is not None:
            kwargs['total_digits'] = args[0]
            kwargs['fraction_digits'] = 0
            if len(args) == 2 and args[1] is not None:
                kwargs['fraction_digits'] = args[1]
                assert args[0] > 0, "'total_digits' must be positive."
                assert args[1] <= args[0], "'total_digits' must be greater than" \
                                          " or equal to 'fraction_digits'." \
                                          " %r ! <= %r" % (args[1], args[0])

        retval = SimpleModel.__new__(cls,  ** kwargs)

        return retval
开发者ID:amgibson,项目名称:spyne,代码行数:16,代码来源:primitive.py


示例17: validate_native

 def validate_native(cls, value):
     return (SimpleModel.validate_native(cls, value)
         and (value is None or (
             _re_match_with_span(cls.Attributes, value)
         )))
开发者ID:codenginebd,项目名称:spyne,代码行数:5,代码来源:primitive.py


示例18: validate_string

 def validate_string(cls, value):
     return SimpleModel.validate_string(cls, value) and (
         value is None or (len(value) <= cls.Attributes.max_str_len)
     )
开发者ID:jrocnuck,项目名称:spyne,代码行数:4,代码来源:primitive.py


示例19: validate_string

 def validate_string(cls, value):
     return SimpleModel.validate_string(cls, value) and value in cls.__values__
开发者ID:jpunwin,项目名称:spyne,代码行数:2,代码来源:enum.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python _base.SimpleModel类代码示例发布时间:2022-05-27
下一篇:
Python xml_schema.XmlSchema类代码示例发布时间: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