微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python graphene 模块-Float() 实例源码

Python graphene 模块,Float() 实例源码

我们从Python开源项目中,提取了以下10代码示例,用于说明如何使用graphene.Float()

项目:elizabeth-cloud    作者:wemake-services    | 项目源码 | 文件源码
def get_field_args(field):
    types = {
        str: graphene.String,
        bool: graphene.Boolean,
        int: graphene.Int,
        float: graphene.Float,
    }

    try:
        args = inspect.signature(field)
        result = {}
        for name, arg in args.parameters.items():
            if arg.default is not None:
                custom_type = types[type(arg.default)]
            else:
                custom_type = graphene.String

            result.update({name: custom_type()})
        return result
    except (KeyError, ValueError):
        return {}
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def convert_form_field_to_float(field):
    return Float(description=field.help_text, required=field.required)
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def test_should_auto_convert_duration():
    assert_conversion(models.DurationField, graphene.Float)
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def test_should_float_convert_float():
    assert_conversion(models.FloatField, graphene.Float)
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def test_should_float_convert_float():
    assert_conversion(forms.FloatField, graphene.Float)
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def test_should_decimal_convert_float():
    assert_conversion(forms.DecimalField, graphene.Float)
项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
def test_should_decimal_convert_float():
    assert_conversion(serializers.DecimalField, graphene.Float, max_digits=4, decimal_places=2)
项目:graphene-gae    作者:graphql-python    | 项目源码 | 文件源码
def convert_ndb_float_property(ndb_prop, registry=None):
    return convert_ndb_scalar_property(Float, ndb_prop)
项目:graphene-gae    作者:graphql-python    | 项目源码 | 文件源码
def testFloatProperty_shouldConvertToString(self):
        self.__assert_conversion(ndb.FloatProperty, graphene.Float)
项目:django-netBox-graphql    作者:ninech    | 项目源码 | 文件源码
def ASNFieldConvert(field, registry=None):
    return graphene.Float()

# Nodes

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐