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


Python graphene.InputObjectType方法代码示例

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


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

示例1: __init_subclass_with_meta__

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def __init_subclass_with_meta__(cls, container=None, _meta=None, **options):
        if not _meta:
            _meta = InputObjectTypeOptions(cls)

        fields = {}
        for base in reversed(cls.__mro__):
            fields.update(yank_fields_from_attrs(base.__dict__, _as=InputField))

        if _meta.fields:
            _meta.fields.update(fields)
        else:
            _meta.fields = fields
        if container is None:
            container = type(cls.__name__, (InputObjectTypeContainer, cls), {})
        _meta.container = container
        super(InputObjectType, cls).__init_subclass_with_meta__(_meta=_meta, **options) 
开发者ID:graphql-python,项目名称:graphene,代码行数:18,代码来源:inputobjecttype.py

示例2: _range_filter_type

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def _range_filter_type(
    type_: 'GRAPHENE_OBJECT_OR_CLASS', _: bool, doc: str
) -> graphene.InputObjectType:
    of_type = _get_class(type_)

    with contextlib.suppress(KeyError):
        return _range_filter_cache[of_type]

    element_type = graphene.NonNull(of_type)
    klass = type(
        str(of_type) + 'Range',
        (graphene.InputObjectType,),
        {RANGE_BEGIN: element_type, RANGE_END: element_type},
    )
    result = klass(description=doc)
    _range_filter_cache[of_type] = result
    return result 
开发者ID:art1415926535,项目名称:graphene-sqlalchemy-filter,代码行数:19,代码来源:filters.py

示例3: convert_serializer_to_input_type

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def convert_serializer_to_input_type(serializer_class):
    cached_type = convert_serializer_to_input_type.cache.get(
        serializer_class.__name__, None
    )
    if cached_type:
        return cached_type
    serializer = serializer_class()

    items = {
        name: convert_serializer_field(field)
        for name, field in serializer.fields.items()
    }
    ret_type = type(
        "{}Input".format(serializer.__class__.__name__),
        (graphene.InputObjectType,),
        items,
    )
    convert_serializer_to_input_type.cache[serializer_class.__name__] = ret_type
    return ret_type 
开发者ID:graphql-python,项目名称:graphene-django,代码行数:21,代码来源:serializer_converter.py

示例4: get_type

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def get_type(cls):
        """
        This function is called when the unmounted type (InputObjectType instance)
        is mounted (as a Field, InputField or Argument)
        """
        return cls 
开发者ID:graphql-python,项目名称:graphene,代码行数:8,代码来源:inputobjecttype.py

示例5: __init__

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def __init__(self):
        self._typeMap = {}
        self.Field = create_registry_field(self)
        self.Argument = create_registry_argument(self)
        self.List = create_registry_list(self)
        self.NonNull = create_registry_nonnull(self)
        registering_metaclass = create_registering_metaclass(self)
        self.Union = create_union(registering_metaclass, self)
        self.Enum = create_enum(registering_metaclass)
        self.Mutation = graphene.Mutation

        # Not looping over GRAPHENE_TYPES in order to not fool lint
        self.ObjectType = create_registering_class(graphene.ObjectType, registering_metaclass)
        self.InputObjectType = create_registering_class(
            graphene.InputObjectType, registering_metaclass
        )
        self.Interface = create_registering_class(graphene.Interface, registering_metaclass)
        self.Scalar = create_registering_class(graphene.Scalar, registering_metaclass)

        # Not looping over GRAPHENE_BUILTINS in order to not fool lint
        self.String = graphene.String
        self.addType(graphene.String)
        self.Int = graphene.Int
        self.addType(graphene.Int)
        self.Float = graphene.Float
        self.addType(graphene.Float)
        self.Boolean = graphene.Boolean
        self.addType(graphene.Boolean)
        self.ID = graphene.ID
        self.addType(graphene.ID)
        self.GenericScalar = GenericScalar
        self.addType(GenericScalar) 
开发者ID:dagster-io,项目名称:dagster,代码行数:34,代码来源:dauphin_registry.py

示例6: _get_value

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def _get_value(self, info, value):
        if isinstance(value, Variable):
            var_name = value.name.value
            value = info.variable_values.get(var_name)
        if isinstance(value, InputObjectType):
            return value.__dict__
        else:
            return GenericScalar.parse_literal(value)
        return value 
开发者ID:tfoxy,项目名称:graphene-django-optimizer,代码行数:11,代码来源:query.py

示例7: get_inputtype

# 需要导入模块: import graphene [as 别名]
# 或者: from graphene import InputObjectType [as 别名]
def get_inputtype(name, object_type):
    """Get an input type based on the object type"""
    if object_type in _input_registry:
        return _input_registry[object_type]

    inputtype = type(
        name,
        (graphene.InputObjectType, ),
        _get_input_attrs(object_type),
    )

    _input_registry[object_type] = inputtype
    return inputtype 
开发者ID:0soft,项目名称:graphene-django-plus,代码行数:15,代码来源:utils.py


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