-
Notifications
You must be signed in to change notification settings - Fork 829
Docs and Example Code Style Guide Work: graphene v 3.0
changeling edited this page Jun 7, 2019
·
3 revisions
Example code and snippets should always be copy/paste complete as running code, unless it's a one-liner or short explanatory snippet for which the context is very (very) clear.
Use explicit imports. from graphene import ...
rather than import graphene
.
Use class arguments instead of class Meta
.
Example: Instead of:
class Human(graphene.ObjectType):
class Meta:
interfaces = (Character, )
starships = graphene.List(Starship)
home_planet = graphene.String()
Use:
class Human(graphene.ObjectType, interfaces = (Character, )):
starships = graphene.List(Starship)
home_planet = graphene.String()
Use f-strings in place of .format(...)
.
Using root
instead of self
or _
in resolver definitions.
@staticmethod
?