From 1ad2ebeebf922c81102463c2255efa55d71972de Mon Sep 17 00:00:00 2001 From: Christian Glacet Date: Thu, 20 May 2021 11:41:10 +0200 Subject: [PATCH] Fix DeprecationWarning (py>3.8) --- graphene/relay/connection.py | 34 +++++++++++++--------------------- graphene/types/field.py | 4 ++-- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/graphene/relay/connection.py b/graphene/relay/connection.py index 047f2b4d..3d18b924 100644 --- a/graphene/relay/connection.py +++ b/graphene/relay/connection.py @@ -1,5 +1,5 @@ import re -from collections import Iterable, OrderedDict +from collections.abc import Iterable from functools import partial from graphql_relay import connection_from_list @@ -86,26 +86,18 @@ class Connection(ObjectType): options["name"] = name _meta.node = node - _meta.fields = OrderedDict( - [ - ( - "page_info", - Field( - PageInfo, - name="pageInfo", - required=True, - description="Pagination data for this connection.", - ), - ), - ( - "edges", - Field( - NonNull(List(edge)), - description="Contains the nodes in this connection.", - ), - ), - ] - ) + _meta.fields = { + "page_info": Field( + PageInfo, + name="pageInfo", + required=True, + description="Pagination data for this connection.", + ), + "edges": Field( + NonNull(List(edge)), + description="Contains the nodes in this connection.", + ), + } return super(Connection, cls).__init_subclass_with_meta__( _meta=_meta, **options ) diff --git a/graphene/types/field.py b/graphene/types/field.py index 7f63a853..1d07fe0c 100644 --- a/graphene/types/field.py +++ b/graphene/types/field.py @@ -1,5 +1,5 @@ import inspect -from collections import Mapping, OrderedDict +from collections.abc import Mapping from functools import partial from .argument import Argument, to_arguments @@ -100,7 +100,7 @@ class Field(MountedType): self.name = name self._type = type - self.args = to_arguments(args or OrderedDict(), extra_args) + self.args = to_arguments(args or dict(), extra_args) if source: resolver = partial(source_resolver, source) self.resolver = resolver