Skip to content

Commit 97ee4df

Browse files
committed
Use Python naming conventions
1 parent 12ec4ba commit 97ee4df

4 files changed

+17
-17
lines changed

tests/star_wars_schema.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def get_node(global_id, _info):
110110

111111
def get_node_type(obj, _info, _type):
112112
if isinstance(obj, Faction):
113-
return factionType
114-
return shipType
113+
return faction_type
114+
return ship_type
115115

116116

117117
node_interface, node_field = node_definitions(get_node, get_node_type)[:2]
@@ -124,7 +124,7 @@ def get_node_type(obj, _info, _type):
124124
# id: String!
125125
# name: String
126126
# }
127-
shipType = GraphQLObjectType(
127+
ship_type = GraphQLObjectType(
128128
name="Ship",
129129
description="A ship in the Star Wars saga",
130130
fields=lambda: {
@@ -148,7 +148,7 @@ def get_node_type(obj, _info, _type):
148148
# cursor: String!
149149
# node: Ship
150150
# }
151-
ship_edge, ship_connection = connection_definitions(shipType, "Ship")
151+
ship_edge, ship_connection = connection_definitions(ship_type, "Ship")
152152

153153
# We define our faction type, which implements the node interface.
154154
#
@@ -158,7 +158,7 @@ def get_node_type(obj, _info, _type):
158158
# name: String
159159
# ships: ShipConnection
160160
# }
161-
factionType = GraphQLObjectType(
161+
faction_type = GraphQLObjectType(
162162
name="Faction",
163163
description="A faction in the Star Wars saga",
164164
fields=lambda: {
@@ -185,11 +185,11 @@ def get_node_type(obj, _info, _type):
185185
# empire: Faction
186186
# node(id: String!): Node
187187
# }
188-
queryType = GraphQLObjectType(
188+
query_type = GraphQLObjectType(
189189
name="Query",
190190
fields=lambda: {
191-
"rebels": GraphQLField(factionType, resolve=lambda _obj, _info: get_rebels()),
192-
"empire": GraphQLField(factionType, resolve=lambda _obj, _info: get_empire()),
191+
"rebels": GraphQLField(faction_type, resolve=lambda _obj, _info: get_rebels()),
192+
"empire": GraphQLField(faction_type, resolve=lambda _obj, _info: get_empire()),
193193
"node": node_field,
194194
},
195195
)
@@ -226,18 +226,18 @@ def mutate_and_get_payload(_info, shipName, factionId, **_input):
226226
return IntroduceShipMutation(shipId=new_ship.id, factionId=factionId)
227227

228228

229-
shipMutation = mutation_with_client_mutation_id(
229+
ship_mutation = mutation_with_client_mutation_id(
230230
"IntroduceShip",
231231
input_fields={
232232
"shipName": GraphQLInputField(GraphQLNonNull(GraphQLString)),
233233
"factionId": GraphQLInputField(GraphQLNonNull(GraphQLID)),
234234
},
235235
output_fields={
236236
"ship": GraphQLField(
237-
shipType, resolve=lambda payload, _info: get_ship(payload.shipId)
237+
ship_type, resolve=lambda payload, _info: get_ship(payload.shipId)
238238
),
239239
"faction": GraphQLField(
240-
factionType, resolve=lambda payload, _info: get_faction(payload.factionId)
240+
faction_type, resolve=lambda payload, _info: get_faction(payload.factionId)
241241
),
242242
},
243243
mutate_and_get_payload=mutate_and_get_payload,
@@ -250,10 +250,10 @@ def mutate_and_get_payload(_info, shipName, factionId, **_input):
250250
# type Mutation {
251251
# introduceShip(input IntroduceShipInput!): IntroduceShipPayload
252252
# }
253-
mutationType = GraphQLObjectType(
254-
"Mutation", fields=lambda: {"introduceShip": shipMutation}
253+
mutation_type = GraphQLObjectType(
254+
"Mutation", fields=lambda: {"introduceShip": ship_mutation}
255255
)
256256

257257
# Finally, we construct our schema (whose starting query type is the query
258258
# type we defined above) and export it.
259-
StarWarsSchema = GraphQLSchema(query=queryType, mutation=mutationType)
259+
star_wars_schema = GraphQLSchema(query=query_type, mutation=mutation_type)

tests/test_star_wars_connections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from graphql import graphql_sync
22

3-
from .star_wars_schema import StarWarsSchema as schema
3+
from .star_wars_schema import star_wars_schema as schema
44

55

66
def describe_star_wars_connections():

tests/test_star_wars_mutations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from graphql import graphql_sync
22

3-
from .star_wars_schema import StarWarsSchema as schema
3+
from .star_wars_schema import star_wars_schema as schema
44

55

66
def describe_star_wars_mutations():

tests/test_star_wars_object_identification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from graphql import graphql_sync
22

3-
from .star_wars_schema import StarWarsSchema as schema
3+
from .star_wars_schema import star_wars_schema as schema
44

55

66
def describe_star_wars_object_identification():

0 commit comments

Comments
 (0)