Fix DeprecationWarning (py>3.8)

This commit is contained in:
Christian Glacet 2021-05-20 11:41:10 +02:00
parent afa44e8a5f
commit 1ad2ebeebf
2 changed files with 15 additions and 23 deletions

View File

@ -1,5 +1,5 @@
import re import re
from collections import Iterable, OrderedDict from collections.abc import Iterable
from functools import partial from functools import partial
from graphql_relay import connection_from_list from graphql_relay import connection_from_list
@ -86,26 +86,18 @@ class Connection(ObjectType):
options["name"] = name options["name"] = name
_meta.node = node _meta.node = node
_meta.fields = OrderedDict( _meta.fields = {
[ "page_info": Field(
( PageInfo,
"page_info", name="pageInfo",
Field( required=True,
PageInfo, description="Pagination data for this connection.",
name="pageInfo", ),
required=True, "edges": Field(
description="Pagination data for this connection.", NonNull(List(edge)),
), description="Contains the nodes in this connection.",
), ),
( }
"edges",
Field(
NonNull(List(edge)),
description="Contains the nodes in this connection.",
),
),
]
)
return super(Connection, cls).__init_subclass_with_meta__( return super(Connection, cls).__init_subclass_with_meta__(
_meta=_meta, **options _meta=_meta, **options
) )

View File

@ -1,5 +1,5 @@
import inspect import inspect
from collections import Mapping, OrderedDict from collections.abc import Mapping
from functools import partial from functools import partial
from .argument import Argument, to_arguments from .argument import Argument, to_arguments
@ -100,7 +100,7 @@ class Field(MountedType):
self.name = name self.name = name
self._type = type self._type = type
self.args = to_arguments(args or OrderedDict(), extra_args) self.args = to_arguments(args or dict(), extra_args)
if source: if source:
resolver = partial(source_resolver, source) resolver = partial(source_resolver, source)
self.resolver = resolver self.resolver = resolver