当前位置: 首页>>代码示例>>Python>>正文


Python SimpleModel.__new__方法代码示例

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


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

示例1: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:27,代码来源:primitive.py

示例2: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:10,代码来源:primitive.py

示例3: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:11,代码来源:primitive.py

示例4: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:12,代码来源:primitive.py

示例5: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:14,代码来源:primitive.py

示例6: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:16,代码来源:binary.py

示例7: __new__

# 需要导入模块: from spyne.model import SimpleModel [as 别名]
# 或者: from spyne.model.SimpleModel import __new__ [as 别名]
    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,代码行数:18,代码来源:primitive.py


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