From 7c874b2477619e76f0d36a7116cbaa6ed91b736b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Clgen=20Sar=C4=B1kavak?= Date: Mon, 7 Feb 2022 17:49:17 +0300 Subject: [PATCH] Update class creation https://github.com/asottile/pyupgrade#new-style-classes --- examples/cookbook-plain/cookbook/ingredients/schema.py | 2 +- examples/cookbook-plain/cookbook/recipes/schema.py | 2 +- examples/cookbook/cookbook/ingredients/schema.py | 2 +- examples/cookbook/cookbook/recipes/schema.py | 2 +- graphene_django/compat.py | 2 +- graphene_django/converter.py | 2 +- graphene_django/debug/middleware.py | 4 ++-- graphene_django/debug/sql/tracking.py | 4 ++-- graphene_django/debug/tests/test_query.py | 2 +- graphene_django/filter/tests/test_fields.py | 2 +- graphene_django/registry.py | 2 +- graphene_django/settings.py | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/cookbook-plain/cookbook/ingredients/schema.py b/examples/cookbook-plain/cookbook/ingredients/schema.py index 1a54c4b..5cf0599 100644 --- a/examples/cookbook-plain/cookbook/ingredients/schema.py +++ b/examples/cookbook-plain/cookbook/ingredients/schema.py @@ -14,7 +14,7 @@ class IngredientType(DjangoObjectType): model = Ingredient -class Query(object): +class Query: category = graphene.Field(CategoryType, id=graphene.Int(), name=graphene.String()) all_categories = graphene.List(CategoryType) diff --git a/examples/cookbook-plain/cookbook/recipes/schema.py b/examples/cookbook-plain/cookbook/recipes/schema.py index b029570..cd886d2 100644 --- a/examples/cookbook-plain/cookbook/recipes/schema.py +++ b/examples/cookbook-plain/cookbook/recipes/schema.py @@ -14,7 +14,7 @@ class RecipeIngredientType(DjangoObjectType): model = RecipeIngredient -class Query(object): +class Query: recipe = graphene.Field(RecipeType, id=graphene.Int(), title=graphene.String()) all_recipes = graphene.List(RecipeType) diff --git a/examples/cookbook/cookbook/ingredients/schema.py b/examples/cookbook/cookbook/ingredients/schema.py index 5e5da80..bde65dc 100644 --- a/examples/cookbook/cookbook/ingredients/schema.py +++ b/examples/cookbook/cookbook/ingredients/schema.py @@ -26,7 +26,7 @@ class IngredientNode(DjangoObjectType): } -class Query(object): +class Query: category = Node.Field(CategoryNode) all_categories = DjangoFilterConnectionField(CategoryNode) diff --git a/examples/cookbook/cookbook/recipes/schema.py b/examples/cookbook/cookbook/recipes/schema.py index fbbedd8..2c81602 100644 --- a/examples/cookbook/cookbook/recipes/schema.py +++ b/examples/cookbook/cookbook/recipes/schema.py @@ -23,7 +23,7 @@ class RecipeIngredientNode(DjangoObjectType): } -class Query(object): +class Query: recipe = Node.Field(RecipeNode) all_recipes = DjangoFilterConnectionField(RecipeNode) diff --git a/graphene_django/compat.py b/graphene_django/compat.py index 537fd1d..311ee72 100644 --- a/graphene_django/compat.py +++ b/graphene_django/compat.py @@ -1,4 +1,4 @@ -class MissingType(object): +class MissingType: pass diff --git a/graphene_django/converter.py b/graphene_django/converter.py index b744e51..8cea71b 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -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_descriptions = {c[0]: c[2] for c in choices} - class EnumWithDescriptionsType(object): + class EnumWithDescriptionsType: @property def description(self): return named_choices_descriptions[self.name] diff --git a/graphene_django/debug/middleware.py b/graphene_django/debug/middleware.py index 0fe3fe3..b2e8386 100644 --- a/graphene_django/debug/middleware.py +++ b/graphene_django/debug/middleware.py @@ -6,7 +6,7 @@ from .sql.tracking import unwrap_cursor, wrap_cursor from .types import DjangoDebug -class DjangoDebugContext(object): +class DjangoDebugContext: def __init__(self): self.debug_promise = None self.promises = [] @@ -40,7 +40,7 @@ class DjangoDebugContext(object): unwrap_cursor(connection) -class DjangoDebugMiddleware(object): +class DjangoDebugMiddleware: def resolve(self, next, root, info, **args): context = info.context django_debug = getattr(context, "django_debug", None) diff --git a/graphene_django/debug/sql/tracking.py b/graphene_django/debug/sql/tracking.py index dc0f2df..95a00b6 100644 --- a/graphene_django/debug/sql/tracking.py +++ b/graphene_django/debug/sql/tracking.py @@ -51,7 +51,7 @@ def unwrap_cursor(connection): del connection._graphene_cursor -class ExceptionCursorWrapper(object): +class ExceptionCursorWrapper: """ Wraps a cursor and raises an exception on any operation. Used in Templates panel. @@ -64,7 +64,7 @@ class ExceptionCursorWrapper(object): raise SQLQueryTriggered() -class NormalCursorWrapper(object): +class NormalCursorWrapper: """ Wraps a cursor and logs queries. """ diff --git a/graphene_django/debug/tests/test_query.py b/graphene_django/debug/tests/test_query.py index d71c3fb..a60f60a 100644 --- a/graphene_django/debug/tests/test_query.py +++ b/graphene_django/debug/tests/test_query.py @@ -8,7 +8,7 @@ from ..middleware import DjangoDebugMiddleware from ..types import DjangoDebug -class context(object): +class context: pass diff --git a/graphene_django/filter/tests/test_fields.py b/graphene_django/filter/tests/test_fields.py index 86b377a..42244aa 100644 --- a/graphene_django/filter/tests/test_fields.py +++ b/graphene_django/filter/tests/test_fields.py @@ -163,7 +163,7 @@ def test_filter_shortcut_filterset_context(): editor=r2, ) - class context(object): + class context: reporter = r2 query = """ diff --git a/graphene_django/registry.py b/graphene_django/registry.py index 50a8ae5..4708637 100644 --- a/graphene_django/registry.py +++ b/graphene_django/registry.py @@ -1,4 +1,4 @@ -class Registry(object): +class Registry: def __init__(self): self._registry = {} self._field_registry = {} diff --git a/graphene_django/settings.py b/graphene_django/settings.py index 8a990dc..9295341 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -89,7 +89,7 @@ def import_from_string(val, setting_name): raise ImportError(msg) -class GrapheneSettings(object): +class GrapheneSettings: """ A settings object, that allows API settings to be accessed as properties. For example: