Skip to content

Commit cf8792e

Browse files
committed
Improved Typemap importing
1 parent 7c57d71 commit cf8792e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

graphene/types/typemap.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
from graphql import (GraphQLArgument, GraphQLBoolean, GraphQLField,
66
GraphQLFloat, GraphQLID, GraphQLInputObjectField,
77
GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLString)
8-
from graphql.type import GraphQLEnumValue
98
from graphql.execution.executor import get_default_resolve_type_fn
9+
from graphql.type import GraphQLEnumValue
1010
from graphql.type.typemap import GraphQLTypeMap
1111

12-
from ..utils.str_converters import to_camel_case
1312
from ..utils.get_unbound_function import get_unbound_function
13+
from ..utils.str_converters import to_camel_case
14+
from .definitions import (GrapheneEnumType, GrapheneInputObjectType,
15+
GrapheneInterfaceType, GrapheneObjectType,
16+
GrapheneScalarType, GrapheneUnionType)
1417
from .dynamic import Dynamic
1518
from .enum import Enum
1619
from .field import Field
@@ -83,7 +86,6 @@ def graphene_reducer(self, map, type):
8386
return map
8487

8588
def construct_scalar(self, map, type):
86-
from .definitions import GrapheneScalarType
8789
_scalars = {
8890
String: GraphQLString,
8991
Int: GraphQLInt,
@@ -106,7 +108,6 @@ def construct_scalar(self, map, type):
106108
return map
107109

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

126127
def construct_objecttype(self, map, type):
127-
from .definitions import GrapheneObjectType
128128
if type._meta.name in map:
129129
_type = map[type._meta.name]
130130
if is_graphene_type(_type):
@@ -148,7 +148,6 @@ def construct_objecttype(self, map, type):
148148
return map
149149

150150
def construct_interface(self, map, type):
151-
from .definitions import GrapheneInterfaceType
152151
_resolve_type = None
153152
if type.resolve_type:
154153
_resolve_type = partial(resolve_type, type.resolve_type, map, type._meta.name)
@@ -164,7 +163,6 @@ def construct_interface(self, map, type):
164163
return map
165164

166165
def construct_inputobjecttype(self, map, type):
167-
from .definitions import GrapheneInputObjectType
168166
map[type._meta.name] = GrapheneInputObjectType(
169167
graphene_type=type,
170168
name=type._meta.name,
@@ -175,7 +173,6 @@ def construct_inputobjecttype(self, map, type):
175173
return map
176174

177175
def construct_union(self, map, type):
178-
from .definitions import GrapheneUnionType
179176
_resolve_type = None
180177
if type.resolve_type:
181178
_resolve_type = partial(resolve_type, type.resolve_type, map, type._meta.name)

0 commit comments

Comments
 (0)