Skip to content

Commit 8f67b20

Browse files
committed
Simplify an elif chain
Partly replicates graphql/graphql-js@dec3cc5
1 parent 7fe0d47 commit 8f67b20

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

graphql/utilities/get_operation_root_type.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,19 @@ def get_operation_root_type(
2424
"Schema does not define the required query root type.", operation
2525
)
2626
return query_type
27-
elif operation_type == OperationType.MUTATION:
27+
28+
if operation_type == OperationType.MUTATION:
2829
mutation_type = schema.mutation_type
2930
if not mutation_type:
3031
raise GraphQLError("Schema is not configured for mutations.", operation)
3132
return mutation_type
32-
elif operation_type == OperationType.SUBSCRIPTION:
33+
34+
if operation_type == OperationType.SUBSCRIPTION:
3335
subscription_type = schema.subscription_type
3436
if not subscription_type:
3537
raise GraphQLError("Schema is not configured for subscriptions.", operation)
3638
return subscription_type
37-
else:
38-
raise GraphQLError(
39-
"Can only have query, mutation and subscription operations.", operation
40-
)
39+
40+
raise GraphQLError(
41+
"Can only have query, mutation and subscription operations.", operation
42+
)

0 commit comments

Comments
 (0)