mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 07:57:26 +03:00 
			
		
		
		
	Merge branch 'refs/heads/master' into features/plugins-autocamelcase
Conflicts: graphene/core/types/argument.py
This commit is contained in:
		
						commit
						730de3f289
					
				|  | @ -11,7 +11,7 @@ from .core import ( | ||||||
|     Interface, |     Interface, | ||||||
|     Mutation, |     Mutation, | ||||||
|     Scalar, |     Scalar, | ||||||
|     BaseType, |     InstanceType, | ||||||
|     LazyType, |     LazyType, | ||||||
|     Argument, |     Argument, | ||||||
|     Field, |     Field, | ||||||
|  | @ -51,7 +51,7 @@ __all__ = [ | ||||||
|     'NonNull', |     'NonNull', | ||||||
|     'signals', |     'signals', | ||||||
|     'Schema', |     'Schema', | ||||||
|     'BaseType', |     'InstanceType', | ||||||
|     'LazyType', |     'LazyType', | ||||||
|     'ObjectType', |     'ObjectType', | ||||||
|     'InputObjectType', |     'InputObjectType', | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ from .classtypes import ( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| from .types import ( | from .types import ( | ||||||
|     BaseType, |     InstanceType, | ||||||
|     LazyType, |     LazyType, | ||||||
|     Argument, |     Argument, | ||||||
|     Field, |     Field, | ||||||
|  | @ -35,7 +35,7 @@ __all__ = [ | ||||||
|     'List', |     'List', | ||||||
|     'NonNull', |     'NonNull', | ||||||
|     'Schema', |     'Schema', | ||||||
|     'BaseType', |     'InstanceType', | ||||||
|     'LazyType', |     'LazyType', | ||||||
|     'ObjectType', |     'ObjectType', | ||||||
|     'InputObjectType', |     'InputObjectType', | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ from graphene import signals | ||||||
| 
 | 
 | ||||||
| from ..plugins import CamelCase, Plugin | from ..plugins import CamelCase, Plugin | ||||||
| from .classtypes.base import ClassType | from .classtypes.base import ClassType | ||||||
| from .types.base import BaseType | from .types.base import InstanceType | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class GraphQLSchema(_GraphQLSchema): | class GraphQLSchema(_GraphQLSchema): | ||||||
|  | @ -59,7 +59,7 @@ class Schema(object): | ||||||
|         if not _type: |         if not _type: | ||||||
|             return |             return | ||||||
|         is_classtype = inspect.isclass(_type) and issubclass(_type, ClassType) |         is_classtype = inspect.isclass(_type) and issubclass(_type, ClassType) | ||||||
|         is_instancetype = isinstance(_type, BaseType) |         is_instancetype = isinstance(_type, InstanceType) | ||||||
|         if is_classtype or is_instancetype: |         if is_classtype or is_instancetype: | ||||||
|             if _type not in self._types: |             if _type not in self._types: | ||||||
|                 internal_type = self.get_internal_type(_type) |                 internal_type = self.get_internal_type(_type) | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| from .base import BaseType, LazyType, OrderedType | from .base import InstanceType, LazyType, OrderedType | ||||||
| from .argument import Argument, ArgumentsGroup, to_arguments | from .argument import Argument, ArgumentsGroup, to_arguments | ||||||
| from .definitions import List, NonNull | from .definitions import List, NonNull | ||||||
| # Compatibility import | # Compatibility import | ||||||
|  | @ -8,7 +8,7 @@ from .scalars import String, ID, Boolean, Int, Float | ||||||
| from .field import Field, InputField | from .field import Field, InputField | ||||||
| 
 | 
 | ||||||
| __all__ = [ | __all__ = [ | ||||||
|     'BaseType', |     'InstanceType', | ||||||
|     'LazyType', |     'LazyType', | ||||||
|     'OrderedType', |     'OrderedType', | ||||||
|     'Argument', |     'Argument', | ||||||
|  |  | ||||||
|  | @ -4,14 +4,13 @@ from functools import partial, total_ordering | ||||||
| import six | import six | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class BaseType(object): | class InstanceType(object): | ||||||
| 
 | 
 | ||||||
|     @classmethod |     def internal_type(self, schema): | ||||||
|     def internal_type(cls, schema): |         raise NotImplementedError("internal_type for type {} is not implemented".format(self.__class__.__name__)) | ||||||
|         return getattr(cls, 'T', None) |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class MountType(BaseType): | class MountType(InstanceType): | ||||||
|     parent = None |     parent = None | ||||||
| 
 | 
 | ||||||
|     def mount(self, cls): |     def mount(self, cls): | ||||||
|  | @ -129,11 +128,11 @@ class MountedType(FieldType, ArgumentType): | ||||||
|     pass |     pass | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class NamedType(BaseType): | class NamedType(InstanceType): | ||||||
|     pass |     pass | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class GroupNamedType(BaseType): | class GroupNamedType(InstanceType): | ||||||
| 
 | 
 | ||||||
|     def __init__(self, *types): |     def __init__(self, *types): | ||||||
|         self.types = types |         self.types = types | ||||||
|  |  | ||||||
|  | @ -4,21 +4,27 @@ from graphql.core.type import (GraphQLBoolean, GraphQLFloat, GraphQLID, | ||||||
| from .base import MountedType | from .base import MountedType | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class String(MountedType): | class ScalarType(MountedType): | ||||||
|     T = GraphQLString | 
 | ||||||
|  |     def internal_type(self, schema): | ||||||
|  |         return self._internal_type | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Int(MountedType): | class String(ScalarType): | ||||||
|     T = GraphQLInt |     _internal_type = GraphQLString | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Boolean(MountedType): | class Int(ScalarType): | ||||||
|     T = GraphQLBoolean |     _internal_type = GraphQLInt | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class ID(MountedType): | class Boolean(ScalarType): | ||||||
|     T = GraphQLID |     _internal_type = GraphQLBoolean | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Float(MountedType): | class ID(ScalarType): | ||||||
|     T = GraphQLFloat |     _internal_type = GraphQLID | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Float(ScalarType): | ||||||
|  |     _internal_type = GraphQLFloat | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user