mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-18 12:02:19 +03:00
Explicitly define kwargs
This commit is contained in:
parent
fcdcae1f57
commit
7f6b62603e
|
@ -20,13 +20,32 @@ class ObjectTypeOptions(BaseOptions):
|
||||||
|
|
||||||
|
|
||||||
class ObjectTypeMeta(BaseTypeMeta):
|
class ObjectTypeMeta(BaseTypeMeta):
|
||||||
def __new__(cls, name_, bases, namespace, **kwargs):
|
def __new__(
|
||||||
|
cls,
|
||||||
|
name_,
|
||||||
|
bases,
|
||||||
|
namespace,
|
||||||
|
name=None,
|
||||||
|
description=None,
|
||||||
|
fields=None,
|
||||||
|
interfaces=(),
|
||||||
|
):
|
||||||
# We create this type, to then overload it with the dataclass attrs
|
# We create this type, to then overload it with the dataclass attrs
|
||||||
class InterObjectType:
|
class InterObjectType:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
kwargs = {}
|
||||||
|
if name:
|
||||||
|
kwargs["name"] = name
|
||||||
|
if description:
|
||||||
|
kwargs["description"] = description
|
||||||
|
if fields:
|
||||||
|
kwargs["fields"] = fields
|
||||||
|
if interfaces:
|
||||||
|
kwargs["interfaces"] = interfaces
|
||||||
|
|
||||||
base_cls = super().__new__(
|
base_cls = super().__new__(
|
||||||
cls, name_, (InterObjectType,) + bases, namespace, **kwargs
|
cls, name_, (InterObjectType,) + bases, namespace, **kwargs,
|
||||||
)
|
)
|
||||||
if base_cls._meta:
|
if base_cls._meta:
|
||||||
fields = [
|
fields = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user