mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-11 16:52:25 +03:00
Update class creation
https://github.com/asottile/pyupgrade#new-style-classes
This commit is contained in:
parent
d96569c40d
commit
7c874b2477
|
@ -14,7 +14,7 @@ class IngredientType(DjangoObjectType):
|
||||||
model = Ingredient
|
model = Ingredient
|
||||||
|
|
||||||
|
|
||||||
class Query(object):
|
class Query:
|
||||||
category = graphene.Field(CategoryType, id=graphene.Int(), name=graphene.String())
|
category = graphene.Field(CategoryType, id=graphene.Int(), name=graphene.String())
|
||||||
all_categories = graphene.List(CategoryType)
|
all_categories = graphene.List(CategoryType)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class RecipeIngredientType(DjangoObjectType):
|
||||||
model = RecipeIngredient
|
model = RecipeIngredient
|
||||||
|
|
||||||
|
|
||||||
class Query(object):
|
class Query:
|
||||||
recipe = graphene.Field(RecipeType, id=graphene.Int(), title=graphene.String())
|
recipe = graphene.Field(RecipeType, id=graphene.Int(), title=graphene.String())
|
||||||
all_recipes = graphene.List(RecipeType)
|
all_recipes = graphene.List(RecipeType)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class IngredientNode(DjangoObjectType):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Query(object):
|
class Query:
|
||||||
category = Node.Field(CategoryNode)
|
category = Node.Field(CategoryNode)
|
||||||
all_categories = DjangoFilterConnectionField(CategoryNode)
|
all_categories = DjangoFilterConnectionField(CategoryNode)
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ class RecipeIngredientNode(DjangoObjectType):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Query(object):
|
class Query:
|
||||||
recipe = Node.Field(RecipeNode)
|
recipe = Node.Field(RecipeNode)
|
||||||
all_recipes = DjangoFilterConnectionField(RecipeNode)
|
all_recipes = DjangoFilterConnectionField(RecipeNode)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class MissingType(object):
|
class MissingType:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ def convert_choices_to_named_enum_with_descriptions(name, choices):
|
||||||
named_choices = [(c[0], c[1]) for c in choices]
|
named_choices = [(c[0], c[1]) for c in choices]
|
||||||
named_choices_descriptions = {c[0]: c[2] for c in choices}
|
named_choices_descriptions = {c[0]: c[2] for c in choices}
|
||||||
|
|
||||||
class EnumWithDescriptionsType(object):
|
class EnumWithDescriptionsType:
|
||||||
@property
|
@property
|
||||||
def description(self):
|
def description(self):
|
||||||
return named_choices_descriptions[self.name]
|
return named_choices_descriptions[self.name]
|
||||||
|
|
|
@ -6,7 +6,7 @@ from .sql.tracking import unwrap_cursor, wrap_cursor
|
||||||
from .types import DjangoDebug
|
from .types import DjangoDebug
|
||||||
|
|
||||||
|
|
||||||
class DjangoDebugContext(object):
|
class DjangoDebugContext:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.debug_promise = None
|
self.debug_promise = None
|
||||||
self.promises = []
|
self.promises = []
|
||||||
|
@ -40,7 +40,7 @@ class DjangoDebugContext(object):
|
||||||
unwrap_cursor(connection)
|
unwrap_cursor(connection)
|
||||||
|
|
||||||
|
|
||||||
class DjangoDebugMiddleware(object):
|
class DjangoDebugMiddleware:
|
||||||
def resolve(self, next, root, info, **args):
|
def resolve(self, next, root, info, **args):
|
||||||
context = info.context
|
context = info.context
|
||||||
django_debug = getattr(context, "django_debug", None)
|
django_debug = getattr(context, "django_debug", None)
|
||||||
|
|
|
@ -51,7 +51,7 @@ def unwrap_cursor(connection):
|
||||||
del connection._graphene_cursor
|
del connection._graphene_cursor
|
||||||
|
|
||||||
|
|
||||||
class ExceptionCursorWrapper(object):
|
class ExceptionCursorWrapper:
|
||||||
"""
|
"""
|
||||||
Wraps a cursor and raises an exception on any operation.
|
Wraps a cursor and raises an exception on any operation.
|
||||||
Used in Templates panel.
|
Used in Templates panel.
|
||||||
|
@ -64,7 +64,7 @@ class ExceptionCursorWrapper(object):
|
||||||
raise SQLQueryTriggered()
|
raise SQLQueryTriggered()
|
||||||
|
|
||||||
|
|
||||||
class NormalCursorWrapper(object):
|
class NormalCursorWrapper:
|
||||||
"""
|
"""
|
||||||
Wraps a cursor and logs queries.
|
Wraps a cursor and logs queries.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,7 +8,7 @@ from ..middleware import DjangoDebugMiddleware
|
||||||
from ..types import DjangoDebug
|
from ..types import DjangoDebug
|
||||||
|
|
||||||
|
|
||||||
class context(object):
|
class context:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ def test_filter_shortcut_filterset_context():
|
||||||
editor=r2,
|
editor=r2,
|
||||||
)
|
)
|
||||||
|
|
||||||
class context(object):
|
class context:
|
||||||
reporter = r2
|
reporter = r2
|
||||||
|
|
||||||
query = """
|
query = """
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Registry(object):
|
class Registry:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._registry = {}
|
self._registry = {}
|
||||||
self._field_registry = {}
|
self._field_registry = {}
|
||||||
|
|
|
@ -89,7 +89,7 @@ def import_from_string(val, setting_name):
|
||||||
raise ImportError(msg)
|
raise ImportError(msg)
|
||||||
|
|
||||||
|
|
||||||
class GrapheneSettings(object):
|
class GrapheneSettings:
|
||||||
"""
|
"""
|
||||||
A settings object, that allows API settings to be accessed as properties.
|
A settings object, that allows API settings to be accessed as properties.
|
||||||
For example:
|
For example:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user