mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-18 03:52:24 +03:00
pre-commit lint
This commit is contained in:
parent
e45a100a69
commit
0f4fd4ea50
16
docs/conf.py
16
docs/conf.py
|
@ -64,18 +64,18 @@ source_suffix = ".rst"
|
||||||
master_doc = "index"
|
master_doc = "index"
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u"Graphene"
|
project = "Graphene"
|
||||||
copyright = u"Graphene 2016"
|
copyright = "Graphene 2016"
|
||||||
author = u"Syrus Akbary"
|
author = "Syrus Akbary"
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = u"1.0"
|
version = "1.0"
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = u"1.0"
|
release = "1.0"
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -278,7 +278,7 @@ latex_elements = {
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(master_doc, "Graphene.tex", u"Graphene Documentation", u"Syrus Akbary", "manual")
|
(master_doc, "Graphene.tex", "Graphene Documentation", "Syrus Akbary", "manual")
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
@ -318,7 +318,7 @@ latex_documents = [
|
||||||
|
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [(master_doc, "graphene", u"Graphene Documentation", [author], 1)]
|
man_pages = [(master_doc, "graphene", "Graphene Documentation", [author], 1)]
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
#
|
#
|
||||||
|
@ -334,7 +334,7 @@ texinfo_documents = [
|
||||||
(
|
(
|
||||||
master_doc,
|
master_doc,
|
||||||
"Graphene",
|
"Graphene",
|
||||||
u"Graphene Documentation",
|
"Graphene Documentation",
|
||||||
author,
|
author,
|
||||||
"Graphene",
|
"Graphene",
|
||||||
"One line description of project.",
|
"One line description of project.",
|
||||||
|
|
|
@ -8,7 +8,6 @@ class Patron(graphene.ObjectType):
|
||||||
|
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
|
|
||||||
patron = graphene.Field(Patron)
|
patron = graphene.Field(Patron)
|
||||||
|
|
||||||
def resolve_patron(self, info):
|
def resolve_patron(self, info):
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# snapshottest: v1 - https://goo.gl/zC4yUc
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from snapshottest import Snapshot
|
from snapshottest import Snapshot
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# snapshottest: v1 - https://goo.gl/zC4yUc
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from snapshottest import Snapshot
|
from snapshottest import Snapshot
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# snapshottest: v1 - https://goo.gl/zC4yUc
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from snapshottest import Snapshot
|
from snapshottest import Snapshot
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# snapshottest: v1 - https://goo.gl/zC4yUc
|
# snapshottest: v1 - https://goo.gl/zC4yUc
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from snapshottest import Snapshot
|
from snapshottest import Snapshot
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from graphql.pyutils.compat import Enum
|
from graphql.pyutils.compat import Enum
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -10,14 +10,13 @@ if not is_init_subclass_available:
|
||||||
if __init_subclass__:
|
if __init_subclass__:
|
||||||
__init_subclass__ = classmethod(__init_subclass__)
|
__init_subclass__ = classmethod(__init_subclass__)
|
||||||
ns["__init_subclass__"] = __init_subclass__
|
ns["__init_subclass__"] = __init_subclass__
|
||||||
return super(InitSubclassMeta, cls).__new__(cls, name, bases, ns, **kwargs)
|
return super().__new__(cls, name, bases, ns, **kwargs)
|
||||||
|
|
||||||
def __init__(cls, name, bases, ns, **kwargs):
|
def __init__(cls, name, bases, ns, **kwargs):
|
||||||
super(InitSubclassMeta, cls).__init__(name, bases, ns)
|
super().__init__(name, bases, ns)
|
||||||
super_class = super(cls, cls)
|
super_class = super(cls, cls)
|
||||||
if hasattr(super_class, "__init_subclass__"):
|
if hasattr(super_class, "__init_subclass__"):
|
||||||
super_class.__init_subclass__.__func__(cls, **kwargs)
|
super_class.__init_subclass__.__func__(cls, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
InitSubclassMeta = type # type: ignore
|
InitSubclassMeta = type # type: ignore
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
Back port of Python 3.3's function signature tools from the inspect module,
|
Back port of Python 3.3's function signature tools from the inspect module,
|
||||||
modified to be compatible with Python 2.7 and 3.2+.
|
modified to be compatible with Python 2.7 and 3.2+.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, division, print_function
|
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
|
@ -177,11 +176,11 @@ def signature(obj):
|
||||||
raise ValueError("callable {!r} is not supported by signature".format(obj))
|
raise ValueError("callable {!r} is not supported by signature".format(obj))
|
||||||
|
|
||||||
|
|
||||||
class _void(object):
|
class _void:
|
||||||
"""A private marker - used in Parameter & Signature"""
|
"""A private marker - used in Parameter & Signature"""
|
||||||
|
|
||||||
|
|
||||||
class _empty(object):
|
class _empty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,7 +204,7 @@ _KEYWORD_ONLY = _ParameterKind(3, name="KEYWORD_ONLY")
|
||||||
_VAR_KEYWORD = _ParameterKind(4, name="VAR_KEYWORD")
|
_VAR_KEYWORD = _ParameterKind(4, name="VAR_KEYWORD")
|
||||||
|
|
||||||
|
|
||||||
class Parameter(object):
|
class Parameter:
|
||||||
"""Represents a parameter in a function signature.
|
"""Represents a parameter in a function signature.
|
||||||
Has the following public attributes:
|
Has the following public attributes:
|
||||||
* name : str
|
* name : str
|
||||||
|
@ -236,7 +235,6 @@ class Parameter(object):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, name, kind, default=_empty, annotation=_empty, _partial_kwarg=False
|
self, name, kind, default=_empty, annotation=_empty, _partial_kwarg=False
|
||||||
):
|
):
|
||||||
|
|
||||||
if kind not in (
|
if kind not in (
|
||||||
_POSITIONAL_ONLY,
|
_POSITIONAL_ONLY,
|
||||||
_POSITIONAL_OR_KEYWORD,
|
_POSITIONAL_OR_KEYWORD,
|
||||||
|
@ -361,7 +359,7 @@ class Parameter(object):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
|
|
||||||
class BoundArguments(object):
|
class BoundArguments:
|
||||||
"""Result of `Signature.bind` call. Holds the mapping of arguments
|
"""Result of `Signature.bind` call. Holds the mapping of arguments
|
||||||
to the function's parameters.
|
to the function's parameters.
|
||||||
Has the following public attributes:
|
Has the following public attributes:
|
||||||
|
@ -456,7 +454,7 @@ class BoundArguments(object):
|
||||||
return not self.__eq__(other)
|
return not self.__eq__(other)
|
||||||
|
|
||||||
|
|
||||||
class Signature(object):
|
class Signature:
|
||||||
"""A Signature object represents the overall signature of a function.
|
"""A Signature object represents the overall signature of a function.
|
||||||
It stores a Parameter object for each parameter accepted by the
|
It stores a Parameter object for each parameter accepted by the
|
||||||
function, as well as information specific to the function itself.
|
function, as well as information specific to the function itself.
|
||||||
|
@ -517,7 +515,7 @@ class Signature(object):
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
params[name] = param
|
params[name] = param
|
||||||
else:
|
else:
|
||||||
params = OrderedDict(((param.name, param) for param in parameters))
|
params = OrderedDict((param.name, param) for param in parameters)
|
||||||
|
|
||||||
self._parameters = params
|
self._parameters = params
|
||||||
self._return_annotation = return_annotation
|
self._return_annotation = return_annotation
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||||
try:
|
try:
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from collections import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class Connection(ObjectType):
|
||||||
edge_class = getattr(cls, "Edge", None)
|
edge_class = getattr(cls, "Edge", None)
|
||||||
_node = node
|
_node = node
|
||||||
|
|
||||||
class EdgeBase(object):
|
class EdgeBase:
|
||||||
node = Field(_node, description="The item at the end of the edge")
|
node = Field(_node, description="The item at the end of the edge")
|
||||||
cursor = String(required=True, description="A cursor for use in pagination")
|
cursor = String(required=True, description="A cursor for use in pagination")
|
||||||
|
|
||||||
|
@ -112,9 +112,7 @@ class Connection(ObjectType):
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return super(Connection, cls).__init_subclass_with_meta__(
|
return super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
_meta=_meta, **options
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class IterableConnectionField(Field):
|
class IterableConnectionField(Field):
|
||||||
|
@ -123,11 +121,11 @@ class IterableConnectionField(Field):
|
||||||
kwargs.setdefault("after", String())
|
kwargs.setdefault("after", String())
|
||||||
kwargs.setdefault("first", Int())
|
kwargs.setdefault("first", Int())
|
||||||
kwargs.setdefault("last", Int())
|
kwargs.setdefault("last", Int())
|
||||||
super(IterableConnectionField, self).__init__(type, *args, **kwargs)
|
super().__init__(type, *args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
type = super(IterableConnectionField, self).type
|
type = super().type
|
||||||
connection_type = type
|
connection_type = type
|
||||||
if isinstance(type, NonNull):
|
if isinstance(type, NonNull):
|
||||||
connection_type = type.of_type
|
connection_type = type.of_type
|
||||||
|
@ -173,7 +171,7 @@ class IterableConnectionField(Field):
|
||||||
return maybe_thenable(resolved, on_resolve)
|
return maybe_thenable(resolved, on_resolve)
|
||||||
|
|
||||||
def get_resolver(self, parent_resolver):
|
def get_resolver(self, parent_resolver):
|
||||||
resolver = super(IterableConnectionField, self).get_resolver(parent_resolver)
|
resolver = super().get_resolver(parent_resolver)
|
||||||
return partial(self.connection_resolver, resolver, self.type)
|
return partial(self.connection_resolver, resolver, self.type)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ClientIDMutation(Mutation):
|
||||||
if not name:
|
if not name:
|
||||||
name = "{}Payload".format(base_name)
|
name = "{}Payload".format(base_name)
|
||||||
|
|
||||||
super(ClientIDMutation, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(
|
||||||
output=None, arguments=arguments, name=name, **options
|
output=None, arguments=arguments, name=name, **options
|
||||||
)
|
)
|
||||||
cls._meta.fields["client_mutation_id"] = Field(String, name="clientMutationId")
|
cls._meta.fields["client_mutation_id"] = Field(String, name="clientMutationId")
|
||||||
|
|
|
@ -28,7 +28,7 @@ def is_node(objecttype):
|
||||||
|
|
||||||
class GlobalID(Field):
|
class GlobalID(Field):
|
||||||
def __init__(self, node=None, parent_type=None, required=True, *args, **kwargs):
|
def __init__(self, node=None, parent_type=None, required=True, *args, **kwargs):
|
||||||
super(GlobalID, self).__init__(ID, required=required, *args, **kwargs)
|
super().__init__(ID, required=required, *args, **kwargs)
|
||||||
self.node = node or Node
|
self.node = node or Node
|
||||||
self.parent_type_name = parent_type._meta.name if parent_type else None
|
self.parent_type_name = parent_type._meta.name if parent_type else None
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class NodeField(Field):
|
||||||
self.node_type = node
|
self.node_type = node
|
||||||
self.field_type = type
|
self.field_type = type
|
||||||
|
|
||||||
super(NodeField, self).__init__(
|
super().__init__(
|
||||||
# If we don's specify a type, the field type will be the node
|
# If we don's specify a type, the field type will be the node
|
||||||
# interface
|
# interface
|
||||||
type or node,
|
type or node,
|
||||||
|
@ -75,7 +75,7 @@ class AbstractNode(Interface):
|
||||||
_meta.fields = OrderedDict(
|
_meta.fields = OrderedDict(
|
||||||
id=GlobalID(cls, description="The ID of the object.")
|
id=GlobalID(cls, description="The ID of the object.")
|
||||||
)
|
)
|
||||||
super(AbstractNode, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
|
|
||||||
class Node(AbstractNode):
|
class Node(AbstractNode):
|
||||||
|
|
|
@ -39,7 +39,7 @@ def test_connection():
|
||||||
|
|
||||||
|
|
||||||
def test_connection_inherit_abstracttype():
|
def test_connection_inherit_abstracttype():
|
||||||
class BaseConnection(object):
|
class BaseConnection:
|
||||||
extra = String()
|
extra = String()
|
||||||
|
|
||||||
class MyObjectConnection(BaseConnection, Connection):
|
class MyObjectConnection(BaseConnection, Connection):
|
||||||
|
@ -54,7 +54,7 @@ def test_connection_inherit_abstracttype():
|
||||||
def test_connection_name():
|
def test_connection_name():
|
||||||
custom_name = "MyObjectCustomNameConnection"
|
custom_name = "MyObjectCustomNameConnection"
|
||||||
|
|
||||||
class BaseConnection(object):
|
class BaseConnection:
|
||||||
extra = String()
|
extra = String()
|
||||||
|
|
||||||
class MyObjectConnection(BaseConnection, Connection):
|
class MyObjectConnection(BaseConnection, Connection):
|
||||||
|
@ -86,7 +86,7 @@ def test_edge():
|
||||||
|
|
||||||
|
|
||||||
def test_edge_with_bases():
|
def test_edge_with_bases():
|
||||||
class BaseEdge(object):
|
class BaseEdge:
|
||||||
extra = String()
|
extra = String()
|
||||||
|
|
||||||
class MyObjectConnection(Connection):
|
class MyObjectConnection(Connection):
|
||||||
|
|
|
@ -17,7 +17,7 @@ class User(ObjectType):
|
||||||
name = String()
|
name = String()
|
||||||
|
|
||||||
|
|
||||||
class Info(object):
|
class Info:
|
||||||
def __init__(self, parent_type):
|
def __init__(self, parent_type):
|
||||||
self.parent_type = GrapheneObjectType(
|
self.parent_type = GrapheneObjectType(
|
||||||
graphene_type=parent_type,
|
graphene_type=parent_type,
|
||||||
|
|
|
@ -15,7 +15,7 @@ from ...types.scalars import String
|
||||||
from ..mutation import ClientIDMutation
|
from ..mutation import ClientIDMutation
|
||||||
|
|
||||||
|
|
||||||
class SharedFields(object):
|
class SharedFields:
|
||||||
shared = String()
|
shared = String()
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class SaySomething(ClientIDMutation):
|
||||||
return SaySomething(phrase=str(what))
|
return SaySomething(phrase=str(what))
|
||||||
|
|
||||||
|
|
||||||
class FixedSaySomething(object):
|
class FixedSaySomething:
|
||||||
__slots__ = ("phrase",)
|
__slots__ = ("phrase",)
|
||||||
|
|
||||||
def __init__(self, phrase):
|
def __init__(self, phrase):
|
||||||
|
|
|
@ -6,8 +6,7 @@ from ...types import ObjectType, Schema, String
|
||||||
from ..node import Node, is_node
|
from ..node import Node, is_node
|
||||||
|
|
||||||
|
|
||||||
class SharedNodeFields(object):
|
class SharedNodeFields:
|
||||||
|
|
||||||
shared = String()
|
shared = String()
|
||||||
something_else = String()
|
something_else = String()
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ def format_execution_result(execution_result, format_error):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
class Client(object):
|
class Client:
|
||||||
def __init__(self, schema, format_error=None, **execute_options):
|
def __init__(self, schema, format_error=None, **execute_options):
|
||||||
assert isinstance(schema, Schema)
|
assert isinstance(schema, Schema)
|
||||||
self.schema = schema
|
self.schema = schema
|
||||||
|
|
|
@ -16,9 +16,7 @@ class SpecialObjectType(ObjectType):
|
||||||
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
||||||
_meta = SpecialOptions(cls)
|
_meta = SpecialOptions(cls)
|
||||||
_meta.other_attr = other_attr
|
_meta.other_attr = other_attr
|
||||||
super(SpecialObjectType, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
_meta=_meta, **options
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_special_objecttype_could_be_subclassed():
|
def test_special_objecttype_could_be_subclassed():
|
||||||
|
@ -55,9 +53,7 @@ class SpecialInputObjectType(InputObjectType):
|
||||||
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
||||||
_meta = SpecialInputObjectTypeOptions(cls)
|
_meta = SpecialInputObjectTypeOptions(cls)
|
||||||
_meta.other_attr = other_attr
|
_meta.other_attr = other_attr
|
||||||
super(SpecialInputObjectType, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
_meta=_meta, **options
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_special_inputobjecttype_could_be_subclassed():
|
def test_special_inputobjecttype_could_be_subclassed():
|
||||||
|
@ -92,7 +88,7 @@ class SpecialEnum(Enum):
|
||||||
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
def __init_subclass_with_meta__(cls, other_attr="default", **options):
|
||||||
_meta = SpecialEnumOptions(cls)
|
_meta = SpecialEnumOptions(cls)
|
||||||
_meta.other_attr = other_attr
|
_meta.other_attr = other_attr
|
||||||
super(SpecialEnum, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
|
|
||||||
def test_special_enum_could_be_subclassed():
|
def test_special_enum_could_be_subclassed():
|
||||||
|
|
|
@ -14,9 +14,7 @@ class MyInputClass(graphene.InputObjectType):
|
||||||
if _meta is None:
|
if _meta is None:
|
||||||
_meta = graphene.types.inputobjecttype.InputObjectTypeOptions(cls)
|
_meta = graphene.types.inputobjecttype.InputObjectTypeOptions(cls)
|
||||||
_meta.fields = fields
|
_meta.fields = fields
|
||||||
super(MyInputClass, cls).__init_subclass_with_meta__(
|
super().__init_subclass_with_meta__(container=container, _meta=_meta, **options)
|
||||||
container=container, _meta=_meta, **options
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MyInput(MyInputClass):
|
class MyInput(MyInputClass):
|
||||||
|
|
|
@ -8,4 +8,4 @@ class AbstractType(SubclassWithMeta):
|
||||||
"Abstract type is deprecated, please use normal object inheritance instead.\n"
|
"Abstract type is deprecated, please use normal object inheritance instead.\n"
|
||||||
"See more: https://github.com/graphql-python/graphene/blob/master/UPGRADE-v2.0.md#deprecations"
|
"See more: https://github.com/graphql-python/graphene/blob/master/UPGRADE-v2.0.md#deprecations"
|
||||||
)
|
)
|
||||||
super(AbstractType, cls).__init_subclass__(*args, **kwargs)
|
super().__init_subclass__(*args, **kwargs)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Argument(MountedType):
|
||||||
required=False,
|
required=False,
|
||||||
_creation_counter=None,
|
_creation_counter=None,
|
||||||
):
|
):
|
||||||
super(Argument, self).__init__(_creation_counter=_creation_counter)
|
super().__init__(_creation_counter=_creation_counter)
|
||||||
|
|
||||||
if required:
|
if required:
|
||||||
type = NonNull(type)
|
type = NonNull(type)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from ..utils.trim_docstring import trim_docstring
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
|
|
||||||
class BaseOptions(object):
|
class BaseOptions:
|
||||||
name = None # type: str
|
name = None # type: str
|
||||||
description = None # type: str
|
description = None # type: str
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class BaseOptions(object):
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
if not self._frozen:
|
if not self._frozen:
|
||||||
super(BaseOptions, self).__setattr__(name, value)
|
super().__setattr__(name, value)
|
||||||
else:
|
else:
|
||||||
raise Exception("Can't modify frozen Options {}".format(self))
|
raise Exception("Can't modify frozen Options {}".format(self))
|
||||||
|
|
||||||
|
@ -42,4 +42,4 @@ class BaseType(SubclassWithMeta):
|
||||||
_meta.description = description or trim_docstring(cls.__doc__)
|
_meta.description = description or trim_docstring(cls.__doc__)
|
||||||
_meta.freeze()
|
_meta.freeze()
|
||||||
cls._meta = _meta
|
cls._meta = _meta
|
||||||
super(BaseType, cls).__init_subclass_with_meta__()
|
super().__init_subclass_with_meta__()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Context(object):
|
class Context:
|
||||||
"""
|
"""
|
||||||
Context can be used to make a convenient container for attributes to provide
|
Context can be used to make a convenient container for attributes to provide
|
||||||
for execution for resolvers of a GraphQL operation like a query.
|
for execution for resolvers of a GraphQL operation like a query.
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from aniso8601 import parse_date, parse_datetime, parse_time
|
from aniso8601 import parse_date, parse_datetime, parse_time
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from decimal import Decimal as _Decimal
|
from decimal import Decimal as _Decimal
|
||||||
|
|
||||||
from graphql.language import ast
|
from graphql.language import ast
|
||||||
|
|
|
@ -8,7 +8,7 @@ from graphql import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class GrapheneGraphQLType(object):
|
class GrapheneGraphQLType:
|
||||||
"""
|
"""
|
||||||
A class for extending the base GraphQLType with the related
|
A class for extending the base GraphQLType with the related
|
||||||
graphene_type
|
graphene_type
|
||||||
|
@ -16,7 +16,7 @@ class GrapheneGraphQLType(object):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.graphene_type = kwargs.pop("graphene_type")
|
self.graphene_type = kwargs.pop("graphene_type")
|
||||||
super(GrapheneGraphQLType, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class GrapheneInterfaceType(GrapheneGraphQLType, GraphQLInterfaceType):
|
class GrapheneInterfaceType(GrapheneGraphQLType, GraphQLInterfaceType):
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Dynamic(MountedType):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, type, with_schema=False, _creation_counter=None):
|
def __init__(self, type, with_schema=False, _creation_counter=None):
|
||||||
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
|
super().__init__(_creation_counter=_creation_counter)
|
||||||
assert inspect.isfunction(type) or isinstance(type, partial)
|
assert inspect.isfunction(type) or isinstance(type, partial)
|
||||||
self.type = type
|
self.type = type
|
||||||
self.with_schema = with_schema
|
self.with_schema = with_schema
|
||||||
|
|
|
@ -50,7 +50,7 @@ class EnumMeta(SubclassWithMeta_Meta):
|
||||||
description=description,
|
description=description,
|
||||||
deprecation_reason=deprecation_reason,
|
deprecation_reason=deprecation_reason,
|
||||||
)
|
)
|
||||||
return super(EnumMeta, cls).__call__(*args, **kwargs)
|
return super().__call__(*args, **kwargs)
|
||||||
# return cls._meta.enum(*args, **kwargs)
|
# return cls._meta.enum(*args, **kwargs)
|
||||||
|
|
||||||
def from_enum(cls, enum, description=None, deprecation_reason=None): # noqa: N805
|
def from_enum(cls, enum, description=None, deprecation_reason=None): # noqa: N805
|
||||||
|
@ -98,7 +98,7 @@ class Enum(UnmountedType, BaseType, metaclass=EnumMeta):
|
||||||
for key, value in _meta.enum.__members__.items():
|
for key, value in _meta.enum.__members__.items():
|
||||||
setattr(cls, key, value)
|
setattr(cls, key, value)
|
||||||
|
|
||||||
super(Enum, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_type(cls):
|
def get_type(cls):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||||
try:
|
try:
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from collections import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class Field(MountedType):
|
||||||
default_value=None,
|
default_value=None,
|
||||||
**extra_args
|
**extra_args
|
||||||
):
|
):
|
||||||
super(Field, self).__init__(_creation_counter=_creation_counter)
|
super().__init__(_creation_counter=_creation_counter)
|
||||||
assert not args or isinstance(args, Mapping), (
|
assert not args or isinstance(args, Mapping), (
|
||||||
'Arguments in a field have to be a mapping, received "{}".'
|
'Arguments in a field have to be a mapping, received "{}".'
|
||||||
).format(args)
|
).format(args)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from graphql.language.ast import (
|
from graphql.language.ast import (
|
||||||
BooleanValue,
|
BooleanValue,
|
||||||
FloatValue,
|
FloatValue,
|
||||||
|
|
|
@ -55,7 +55,7 @@ class InputField(MountedType):
|
||||||
_creation_counter=None,
|
_creation_counter=None,
|
||||||
**extra_args
|
**extra_args
|
||||||
):
|
):
|
||||||
super(InputField, self).__init__(_creation_counter=_creation_counter)
|
super().__init__(_creation_counter=_creation_counter)
|
||||||
self.name = name
|
self.name = name
|
||||||
if required:
|
if required:
|
||||||
type = NonNull(type)
|
type = NonNull(type)
|
||||||
|
|
|
@ -81,7 +81,7 @@ class InputObjectType(UnmountedType, BaseType):
|
||||||
if container is None:
|
if container is None:
|
||||||
container = type(cls.__name__, (InputObjectTypeContainer, cls), {})
|
container = type(cls.__name__, (InputObjectTypeContainer, cls), {})
|
||||||
_meta.container = container
|
_meta.container = container
|
||||||
super(InputObjectType, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_type(cls):
|
def get_type(cls):
|
||||||
|
|
|
@ -60,7 +60,7 @@ class Interface(BaseType):
|
||||||
else:
|
else:
|
||||||
_meta.fields = fields
|
_meta.fields = fields
|
||||||
|
|
||||||
super(Interface, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from graphql.language import ast
|
from graphql.language import ast
|
||||||
|
|
|
@ -129,7 +129,7 @@ class Mutation(ObjectType):
|
||||||
_meta.resolver = resolver
|
_meta.resolver = resolver
|
||||||
_meta.arguments = arguments
|
_meta.arguments = arguments
|
||||||
|
|
||||||
super(Mutation, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def Field(
|
def Field(
|
||||||
|
|
|
@ -126,7 +126,7 @@ class ObjectType(BaseType):
|
||||||
_meta.possible_types = possible_types
|
_meta.possible_types = possible_types
|
||||||
_meta.default_resolver = default_resolver
|
_meta.default_resolver = default_resolver
|
||||||
|
|
||||||
super(ObjectType, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
is_type_of = None
|
is_type_of = None
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Scalar(UnmountedType, BaseType):
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, **options):
|
def __init_subclass_with_meta__(cls, **options):
|
||||||
_meta = ScalarOptions(cls)
|
_meta = ScalarOptions(cls)
|
||||||
super(Scalar, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
serialize = None
|
serialize = None
|
||||||
parse_value = None
|
parse_value = None
|
||||||
|
@ -111,7 +111,7 @@ class String(Scalar):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def coerce_string(value):
|
def coerce_string(value):
|
||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
return u"true" if value else u"false"
|
return "true" if value else "false"
|
||||||
return str(value)
|
return str(value)
|
||||||
|
|
||||||
serialize = coerce_string
|
serialize = coerce_string
|
||||||
|
|
|
@ -93,7 +93,7 @@ class Schema(GraphQLSchema):
|
||||||
|
|
||||||
Example: using schema.Query for accessing the "Query" type in the Schema
|
Example: using schema.Query for accessing the "Query" type in the Schema
|
||||||
"""
|
"""
|
||||||
_type = super(Schema, self).get_type(type_name)
|
_type = super().get_type(type_name)
|
||||||
if _type is None:
|
if _type is None:
|
||||||
raise AttributeError('Type "{}" not found in the Schema'.format(type_name))
|
raise AttributeError('Type "{}" not found in the Schema'.format(type_name))
|
||||||
if isinstance(_type, GrapheneGraphQLType):
|
if isinstance(_type, GrapheneGraphQLType):
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Structure(UnmountedType):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, of_type, *args, **kwargs):
|
def __init__(self, of_type, *args, **kwargs):
|
||||||
super(Structure, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
if not isinstance(of_type, Structure) and isinstance(of_type, UnmountedType):
|
if not isinstance(of_type, Structure) and isinstance(of_type, UnmountedType):
|
||||||
cls_name = type(self).__name__
|
cls_name = type(self).__name__
|
||||||
of_type_name = type(of_type).__name__
|
of_type_name = type(of_type).__name__
|
||||||
|
@ -84,7 +84,7 @@ class NonNull(Structure):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(NonNull, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
assert not isinstance(self._of_type, NonNull), (
|
assert not isinstance(self._of_type, NonNull), (
|
||||||
"Can only create NonNull of a Nullable GraphQLType but got: {}."
|
"Can only create NonNull of a Nullable GraphQLType but got: {}."
|
||||||
).format(self._of_type)
|
).format(self._of_type)
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CustomType(BaseType):
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, **options):
|
def __init_subclass_with_meta__(cls, **options):
|
||||||
_meta = CustomOptions(cls)
|
_meta = CustomOptions(cls)
|
||||||
super(CustomType, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
|
|
||||||
def test_basetype():
|
def test_basetype():
|
||||||
|
|
|
@ -281,7 +281,7 @@ def test_stringifies_simple_types():
|
||||||
|
|
||||||
|
|
||||||
def test_does_not_mutate_passed_field_definitions():
|
def test_does_not_mutate_passed_field_definitions():
|
||||||
class CommonFields(object):
|
class CommonFields:
|
||||||
field1 = String()
|
field1 = String()
|
||||||
field2 = String(id=String())
|
field2 = String(id=String())
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ def test_does_not_mutate_passed_field_definitions():
|
||||||
|
|
||||||
assert TestObject1._meta.fields == TestObject2._meta.fields
|
assert TestObject1._meta.fields == TestObject2._meta.fields
|
||||||
|
|
||||||
class CommonFields(object):
|
class CommonFields:
|
||||||
field1 = String()
|
field1 = String()
|
||||||
field2 = String()
|
field2 = String()
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,6 @@ def test_enum_from_builtin_enum_accepts_lambda_description():
|
||||||
|
|
||||||
|
|
||||||
def test_enum_from_python3_enum_uses_enum_doc():
|
def test_enum_from_python3_enum_uses_enum_doc():
|
||||||
|
|
||||||
from enum import Enum as PyEnum
|
from enum import Enum as PyEnum
|
||||||
|
|
||||||
class Color(PyEnum):
|
class Color(PyEnum):
|
||||||
|
|
|
@ -9,7 +9,7 @@ from ..structures import NonNull
|
||||||
from .utils import MyLazyType
|
from .utils import MyLazyType
|
||||||
|
|
||||||
|
|
||||||
class MyInstance(object):
|
class MyInstance:
|
||||||
value = "value"
|
value = "value"
|
||||||
value_func = staticmethod(lambda: "value_func")
|
value_func = staticmethod(lambda: "value_func")
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from ..schema import Schema
|
||||||
from ..unmountedtype import UnmountedType
|
from ..unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
|
||||||
class MyType(object):
|
class MyType:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ def test_generate_inputobjecttype_as_argument():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_inputobjecttype_inherit_abstracttype():
|
def test_generate_inputobjecttype_inherit_abstracttype():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar(MyType)
|
field1 = MyScalar(MyType)
|
||||||
|
|
||||||
class MyInputObjectType(InputObjectType, MyAbstractType):
|
class MyInputObjectType(InputObjectType, MyAbstractType):
|
||||||
|
@ -92,7 +92,7 @@ def test_generate_inputobjecttype_inherit_abstracttype():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_inputobjecttype_inherit_abstracttype_reversed():
|
def test_generate_inputobjecttype_inherit_abstracttype_reversed():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar(MyType)
|
field1 = MyScalar(MyType)
|
||||||
|
|
||||||
class MyInputObjectType(MyAbstractType, InputObjectType):
|
class MyInputObjectType(MyAbstractType, InputObjectType):
|
||||||
|
|
|
@ -3,7 +3,7 @@ from ..interface import Interface
|
||||||
from ..unmountedtype import UnmountedType
|
from ..unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
|
||||||
class MyType(object):
|
class MyType:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def test_generate_interface_unmountedtype():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_interface_inherit_abstracttype():
|
def test_generate_interface_inherit_abstracttype():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar()
|
field1 = MyScalar()
|
||||||
|
|
||||||
class MyInterface(Interface, MyAbstractType):
|
class MyInterface(Interface, MyAbstractType):
|
||||||
|
@ -80,7 +80,7 @@ def test_generate_interface_inherit_interface():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_interface_inherit_abstracttype_reversed():
|
def test_generate_interface_inherit_abstracttype_reversed():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar()
|
field1 = MyScalar()
|
||||||
|
|
||||||
class MyInterface(MyAbstractType, Interface):
|
class MyInterface(MyAbstractType, Interface):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from ..scalars import String
|
||||||
class CustomField(Field):
|
class CustomField(Field):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.metadata = kwargs.pop("metadata", None)
|
self.metadata = kwargs.pop("metadata", None)
|
||||||
super(CustomField, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def test_mounted_type():
|
def test_mounted_type():
|
||||||
|
|
|
@ -106,7 +106,7 @@ def test_ordered_fields_in_objecttype():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_objecttype_inherit_abstracttype():
|
def test_generate_objecttype_inherit_abstracttype():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar()
|
field1 = MyScalar()
|
||||||
|
|
||||||
class MyObjectType(ObjectType, MyAbstractType):
|
class MyObjectType(ObjectType, MyAbstractType):
|
||||||
|
@ -120,7 +120,7 @@ def test_generate_objecttype_inherit_abstracttype():
|
||||||
|
|
||||||
|
|
||||||
def test_generate_objecttype_inherit_abstracttype_reversed():
|
def test_generate_objecttype_inherit_abstracttype_reversed():
|
||||||
class MyAbstractType(object):
|
class MyAbstractType:
|
||||||
field1 = MyScalar()
|
field1 = MyScalar()
|
||||||
|
|
||||||
class MyObjectType(MyAbstractType, ObjectType):
|
class MyObjectType(MyAbstractType, ObjectType):
|
||||||
|
|
|
@ -28,7 +28,7 @@ def test_query():
|
||||||
|
|
||||||
|
|
||||||
def test_query_source():
|
def test_query_source():
|
||||||
class Root(object):
|
class Root:
|
||||||
_hello = "World"
|
_hello = "World"
|
||||||
|
|
||||||
def hello(self):
|
def hello(self):
|
||||||
|
@ -45,10 +45,10 @@ def test_query_source():
|
||||||
|
|
||||||
|
|
||||||
def test_query_union():
|
def test_query_union():
|
||||||
class one_object(object):
|
class one_object:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class two_object(object):
|
class two_object:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class One(ObjectType):
|
class One(ObjectType):
|
||||||
|
@ -83,10 +83,10 @@ def test_query_union():
|
||||||
|
|
||||||
|
|
||||||
def test_query_interface():
|
def test_query_interface():
|
||||||
class one_object(object):
|
class one_object:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class two_object(object):
|
class two_object:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class MyInterface(Interface):
|
class MyInterface(Interface):
|
||||||
|
|
|
@ -13,7 +13,7 @@ info = None
|
||||||
demo_dict = {"attr": "value"}
|
demo_dict = {"attr": "value"}
|
||||||
|
|
||||||
|
|
||||||
class demo_obj(object):
|
class demo_obj:
|
||||||
attr = "value"
|
attr = "value"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ def test_serializes_output_string():
|
||||||
assert String.serialize(-1.1) == "-1.1"
|
assert String.serialize(-1.1) == "-1.1"
|
||||||
assert String.serialize(True) == "true"
|
assert String.serialize(True) == "true"
|
||||||
assert String.serialize(False) == "false"
|
assert String.serialize(False) == "false"
|
||||||
assert String.serialize(u"\U0001F601") == u"\U0001F601"
|
assert String.serialize("\U0001F601") == "\U0001F601"
|
||||||
|
|
||||||
|
|
||||||
def test_serializes_output_boolean():
|
def test_serializes_output_boolean():
|
||||||
|
|
|
@ -77,7 +77,7 @@ class TypeMap(GraphQLTypeMap):
|
||||||
def __init__(self, types, auto_camelcase=True, schema=None):
|
def __init__(self, types, auto_camelcase=True, schema=None):
|
||||||
self.auto_camelcase = auto_camelcase
|
self.auto_camelcase = auto_camelcase
|
||||||
self.schema = schema
|
self.schema = schema
|
||||||
super(TypeMap, self).__init__(types)
|
super().__init__(types)
|
||||||
|
|
||||||
def reducer(self, map, type):
|
def reducer(self, map, type):
|
||||||
if not type:
|
if not type:
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Union(UnmountedType, BaseType):
|
||||||
|
|
||||||
_meta = UnionOptions(cls)
|
_meta = UnionOptions(cls)
|
||||||
_meta.types = types
|
_meta.types = types
|
||||||
super(Union, cls).__init_subclass_with_meta__(_meta=_meta, **options)
|
super().__init_subclass_with_meta__(_meta=_meta, **options)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_type(cls):
|
def get_type(cls):
|
||||||
|
|
|
@ -40,7 +40,7 @@ class UnmountedType(OrderedType):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(UnmountedType, self).__init__()
|
super().__init__()
|
||||||
self.args = args
|
self.args = args
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from __future__ import absolute_import
|
|
||||||
from uuid import UUID as _UUID
|
from uuid import UUID as _UUID
|
||||||
|
|
||||||
from graphql.language import ast
|
from graphql.language import ast
|
||||||
|
|
|
@ -3,7 +3,7 @@ import json
|
||||||
try:
|
try:
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from collections import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
|
||||||
def to_key(value):
|
def to_key(value):
|
||||||
|
|
|
@ -3,7 +3,7 @@ from collections import OrderedDict
|
||||||
try:
|
try:
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from collections import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
|
||||||
def deflate(node, index=None, path=None):
|
def deflate(node, index=None, path=None):
|
||||||
|
|
|
@ -2,7 +2,7 @@ import functools
|
||||||
import inspect
|
import inspect
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
string_types = (type(b""), type(u""))
|
string_types = (bytes, str)
|
||||||
|
|
||||||
|
|
||||||
def warn_deprecation(text):
|
def warn_deprecation(text):
|
||||||
|
@ -17,7 +17,6 @@ def deprecated(reason):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if isinstance(reason, string_types):
|
if isinstance(reason, string_types):
|
||||||
|
|
||||||
# The @deprecated is used with a 'reason'.
|
# The @deprecated is used with a 'reason'.
|
||||||
#
|
#
|
||||||
# .. code-block:: python
|
# .. code-block:: python
|
||||||
|
@ -27,7 +26,6 @@ def deprecated(reason):
|
||||||
# pass
|
# pass
|
||||||
|
|
||||||
def decorator(func1):
|
def decorator(func1):
|
||||||
|
|
||||||
if inspect.isclass(func1):
|
if inspect.isclass(func1):
|
||||||
fmt1 = "Call to deprecated class {name} ({reason})."
|
fmt1 = "Call to deprecated class {name} ({reason})."
|
||||||
else:
|
else:
|
||||||
|
@ -43,7 +41,6 @@ def deprecated(reason):
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
elif inspect.isclass(reason) or inspect.isfunction(reason):
|
elif inspect.isclass(reason) or inspect.isfunction(reason):
|
||||||
|
|
||||||
# The @deprecated is used without any 'reason'.
|
# The @deprecated is used without any 'reason'.
|
||||||
#
|
#
|
||||||
# .. code-block:: python
|
# .. code-block:: python
|
||||||
|
|
|
@ -2,7 +2,7 @@ from functools import total_ordering
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class OrderedType(object):
|
class OrderedType:
|
||||||
creation_counter = 1
|
creation_counter = 1
|
||||||
|
|
||||||
def __init__(self, _creation_counter=None):
|
def __init__(self, _creation_counter=None):
|
||||||
|
@ -36,4 +36,4 @@ class OrderedType(object):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash((self.creation_counter))
|
return hash(self.creation_counter)
|
||||||
|
|
|
@ -2,7 +2,7 @@ class _OldClass:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _NewClass(object):
|
class _NewClass:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# coding: utf-8
|
|
||||||
from ..str_converters import to_camel_case, to_const, to_snake_case
|
from ..str_converters import to_camel_case, to_const, to_snake_case
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from ..trim_docstring import trim_docstring
|
||||||
|
|
||||||
|
|
||||||
def test_trim_docstring():
|
def test_trim_docstring():
|
||||||
class WellDocumentedObject(object):
|
class WellDocumentedObject:
|
||||||
"""
|
"""
|
||||||
This object is very well-documented. It has multiple lines in its
|
This object is very well-documented. It has multiple lines in its
|
||||||
description.
|
description.
|
||||||
|
@ -16,7 +16,7 @@ def test_trim_docstring():
|
||||||
"description.\n\nMultiple paragraphs too"
|
"description.\n\nMultiple paragraphs too"
|
||||||
)
|
)
|
||||||
|
|
||||||
class UndocumentedObject(object):
|
class UndocumentedObject:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
assert trim_docstring(UndocumentedObject.__doc__) is None
|
assert trim_docstring(UndocumentedObject.__doc__) is None
|
||||||
|
|
|
@ -9,7 +9,7 @@ try:
|
||||||
from promise import Promise, is_thenable # type: ignore
|
from promise import Promise, is_thenable # type: ignore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
class Promise(object): # type: ignore
|
class Promise: # type: ignore
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def is_thenable(obj): # type: ignore
|
def is_thenable(obj): # type: ignore
|
||||||
|
|
|
@ -6,7 +6,7 @@ from graphene.types.scalars import String
|
||||||
from graphene.relay.mutation import ClientIDMutation
|
from graphene.relay.mutation import ClientIDMutation
|
||||||
|
|
||||||
|
|
||||||
class SharedFields(object):
|
class SharedFields:
|
||||||
shared = String()
|
shared = String()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user