Skip to content

Commit

Permalink
Improved Typemap importing
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Nov 23, 2016
1 parent 7c57d71 commit cf8792e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions graphene/types/typemap.py
Expand Up @@ -5,12 +5,15 @@
from graphql import (GraphQLArgument, GraphQLBoolean, GraphQLField,
GraphQLFloat, GraphQLID, GraphQLInputObjectField,
GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLString)
from graphql.type import GraphQLEnumValue
from graphql.execution.executor import get_default_resolve_type_fn
from graphql.type import GraphQLEnumValue
from graphql.type.typemap import GraphQLTypeMap

from ..utils.str_converters import to_camel_case
from ..utils.get_unbound_function import get_unbound_function
from ..utils.str_converters import to_camel_case
from .definitions import (GrapheneEnumType, GrapheneInputObjectType,
GrapheneInterfaceType, GrapheneObjectType,
GrapheneScalarType, GrapheneUnionType)
from .dynamic import Dynamic
from .enum import Enum
from .field import Field
Expand Down Expand Up @@ -83,7 +86,6 @@ def graphene_reducer(self, map, type):
return map

def construct_scalar(self, map, type):
from .definitions import GrapheneScalarType
_scalars = {
String: GraphQLString,
Int: GraphQLInt,
Expand All @@ -106,7 +108,6 @@ def construct_scalar(self, map, type):
return map

def construct_enum(self, map, type):
from .definitions import GrapheneEnumType
values = OrderedDict()
for name, value in type._meta.enum.__members__.items():
values[name] = GraphQLEnumValue(
Expand All @@ -124,7 +125,6 @@ def construct_enum(self, map, type):
return map

def construct_objecttype(self, map, type):
from .definitions import GrapheneObjectType
if type._meta.name in map:
_type = map[type._meta.name]
if is_graphene_type(_type):
Expand All @@ -148,7 +148,6 @@ def construct_objecttype(self, map, type):
return map

def construct_interface(self, map, type):
from .definitions import GrapheneInterfaceType
_resolve_type = None
if type.resolve_type:
_resolve_type = partial(resolve_type, type.resolve_type, map, type._meta.name)
Expand All @@ -164,7 +163,6 @@ def construct_interface(self, map, type):
return map

def construct_inputobjecttype(self, map, type):
from .definitions import GrapheneInputObjectType
map[type._meta.name] = GrapheneInputObjectType(
graphene_type=type,
name=type._meta.name,
Expand All @@ -175,7 +173,6 @@ def construct_inputobjecttype(self, map, type):
return map

def construct_union(self, map, type):
from .definitions import GrapheneUnionType
_resolve_type = None
if type.resolve_type:
_resolve_type = partial(resolve_type, type.resolve_type, map, type._meta.name)
Expand Down

0 comments on commit cf8792e

Please sign in to comment.