pre-commit lint

This commit is contained in:
Wong Chun Hong 2023-08-30 00:29:46 +01:00
parent e45a100a69
commit 0f4fd4ea50
64 changed files with 94 additions and 133 deletions

View File

@ -64,18 +64,18 @@ source_suffix = ".rst"
master_doc = "index"
# General information about the project.
project = u"Graphene"
copyright = u"Graphene 2016"
author = u"Syrus Akbary"
project = "Graphene"
copyright = "Graphene 2016"
author = "Syrus Akbary"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u"1.0"
version = "1.0"
# 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
# for a list of supported languages.
@ -278,7 +278,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
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
@ -318,7 +318,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (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.
#
@ -334,7 +334,7 @@ texinfo_documents = [
(
master_doc,
"Graphene",
u"Graphene Documentation",
"Graphene Documentation",
author,
"Graphene",
"One line description of project.",

View File

@ -8,7 +8,6 @@ class Patron(graphene.ObjectType):
class Query(graphene.ObjectType):
patron = graphene.Field(Patron)
def resolve_patron(self, info):

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot

View File

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from graphql.pyutils.compat import Enum
try:

View File

@ -10,14 +10,13 @@ if not is_init_subclass_available:
if __init_subclass__:
__init_subclass__ = classmethod(__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):
super(InitSubclassMeta, cls).__init__(name, bases, ns)
super().__init__(name, bases, ns)
super_class = super(cls, cls)
if hasattr(super_class, "__init_subclass__"):
super_class.__init_subclass__.__func__(cls, **kwargs)
else:
InitSubclassMeta = type # type: ignore

View File

@ -3,7 +3,6 @@
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+.
"""
from __future__ import absolute_import, division, print_function
import functools
import itertools
@ -177,11 +176,11 @@ def signature(obj):
raise ValueError("callable {!r} is not supported by signature".format(obj))
class _void(object):
class _void:
"""A private marker - used in Parameter & Signature"""
class _empty(object):
class _empty:
pass
@ -205,7 +204,7 @@ _KEYWORD_ONLY = _ParameterKind(3, name="KEYWORD_ONLY")
_VAR_KEYWORD = _ParameterKind(4, name="VAR_KEYWORD")
class Parameter(object):
class Parameter:
"""Represents a parameter in a function signature.
Has the following public attributes:
* name : str
@ -236,7 +235,6 @@ class Parameter(object):
def __init__(
self, name, kind, default=_empty, annotation=_empty, _partial_kwarg=False
):
if kind not in (
_POSITIONAL_ONLY,
_POSITIONAL_OR_KEYWORD,
@ -361,7 +359,7 @@ class Parameter(object):
return not self.__eq__(other)
class BoundArguments(object):
class BoundArguments:
"""Result of `Signature.bind` call. Holds the mapping of arguments
to the function's parameters.
Has the following public attributes:
@ -456,7 +454,7 @@ class BoundArguments(object):
return not self.__eq__(other)
class Signature(object):
class Signature:
"""A Signature object represents the overall signature of a function.
It stores a Parameter object for each parameter accepted by the
function, as well as information specific to the function itself.
@ -517,7 +515,7 @@ class Signature(object):
raise ValueError(msg)
params[name] = param
else:
params = OrderedDict(((param.name, param) for param in parameters))
params = OrderedDict((param.name, param) for param in parameters)
self._parameters = params
self._return_annotation = return_annotation

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
import datetime
import os
import subprocess

View File

@ -4,7 +4,7 @@ from collections import OrderedDict
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from collections.abc import Iterable
from functools import partial
@ -72,7 +72,7 @@ class Connection(ObjectType):
edge_class = getattr(cls, "Edge", None)
_node = node
class EdgeBase(object):
class EdgeBase:
node = Field(_node, description="The item at the end of the edge")
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__(
_meta=_meta, **options
)
return super().__init_subclass_with_meta__(_meta=_meta, **options)
class IterableConnectionField(Field):
@ -123,11 +121,11 @@ class IterableConnectionField(Field):
kwargs.setdefault("after", String())
kwargs.setdefault("first", Int())
kwargs.setdefault("last", Int())
super(IterableConnectionField, self).__init__(type, *args, **kwargs)
super().__init__(type, *args, **kwargs)
@property
def type(self):
type = super(IterableConnectionField, self).type
type = super().type
connection_type = type
if isinstance(type, NonNull):
connection_type = type.of_type
@ -173,7 +171,7 @@ class IterableConnectionField(Field):
return maybe_thenable(resolved, on_resolve)
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)

View File

@ -49,7 +49,7 @@ class ClientIDMutation(Mutation):
if not 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
)
cls._meta.fields["client_mutation_id"] = Field(String, name="clientMutationId")

View File

@ -28,7 +28,7 @@ def is_node(objecttype):
class GlobalID(Field):
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.parent_type_name = parent_type._meta.name if parent_type else None
@ -53,7 +53,7 @@ class NodeField(Field):
self.node_type = node
self.field_type = type
super(NodeField, self).__init__(
super().__init__(
# If we don's specify a type, the field type will be the node
# interface
type or node,
@ -75,7 +75,7 @@ class AbstractNode(Interface):
_meta.fields = OrderedDict(
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):

View File

@ -39,7 +39,7 @@ def test_connection():
def test_connection_inherit_abstracttype():
class BaseConnection(object):
class BaseConnection:
extra = String()
class MyObjectConnection(BaseConnection, Connection):
@ -54,7 +54,7 @@ def test_connection_inherit_abstracttype():
def test_connection_name():
custom_name = "MyObjectCustomNameConnection"
class BaseConnection(object):
class BaseConnection:
extra = String()
class MyObjectConnection(BaseConnection, Connection):
@ -86,7 +86,7 @@ def test_edge():
def test_edge_with_bases():
class BaseEdge(object):
class BaseEdge:
extra = String()
class MyObjectConnection(Connection):

View File

@ -17,7 +17,7 @@ class User(ObjectType):
name = String()
class Info(object):
class Info:
def __init__(self, parent_type):
self.parent_type = GrapheneObjectType(
graphene_type=parent_type,

View File

@ -15,7 +15,7 @@ from ...types.scalars import String
from ..mutation import ClientIDMutation
class SharedFields(object):
class SharedFields:
shared = String()
@ -37,7 +37,7 @@ class SaySomething(ClientIDMutation):
return SaySomething(phrase=str(what))
class FixedSaySomething(object):
class FixedSaySomething:
__slots__ = ("phrase",)
def __init__(self, phrase):

View File

@ -6,8 +6,7 @@ from ...types import ObjectType, Schema, String
from ..node import Node, is_node
class SharedNodeFields(object):
class SharedNodeFields:
shared = String()
something_else = String()

View File

@ -24,7 +24,7 @@ def format_execution_result(execution_result, format_error):
return response
class Client(object):
class Client:
def __init__(self, schema, format_error=None, **execute_options):
assert isinstance(schema, Schema)
self.schema = schema

View File

@ -16,9 +16,7 @@ class SpecialObjectType(ObjectType):
def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialOptions(cls)
_meta.other_attr = other_attr
super(SpecialObjectType, cls).__init_subclass_with_meta__(
_meta=_meta, **options
)
super().__init_subclass_with_meta__(_meta=_meta, **options)
def test_special_objecttype_could_be_subclassed():
@ -55,9 +53,7 @@ class SpecialInputObjectType(InputObjectType):
def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialInputObjectTypeOptions(cls)
_meta.other_attr = other_attr
super(SpecialInputObjectType, cls).__init_subclass_with_meta__(
_meta=_meta, **options
)
super().__init_subclass_with_meta__(_meta=_meta, **options)
def test_special_inputobjecttype_could_be_subclassed():
@ -92,7 +88,7 @@ class SpecialEnum(Enum):
def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialEnumOptions(cls)
_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():

View File

@ -14,9 +14,7 @@ class MyInputClass(graphene.InputObjectType):
if _meta is None:
_meta = graphene.types.inputobjecttype.InputObjectTypeOptions(cls)
_meta.fields = fields
super(MyInputClass, cls).__init_subclass_with_meta__(
container=container, _meta=_meta, **options
)
super().__init_subclass_with_meta__(container=container, _meta=_meta, **options)
class MyInput(MyInputClass):

View File

@ -8,4 +8,4 @@ class AbstractType(SubclassWithMeta):
"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"
)
super(AbstractType, cls).__init_subclass__(*args, **kwargs)
super().__init_subclass__(*args, **kwargs)

View File

@ -48,7 +48,7 @@ class Argument(MountedType):
required=False,
_creation_counter=None,
):
super(Argument, self).__init__(_creation_counter=_creation_counter)
super().__init__(_creation_counter=_creation_counter)
if required:
type = NonNull(type)

View File

@ -4,7 +4,7 @@ from ..utils.trim_docstring import trim_docstring
from typing import Type
class BaseOptions(object):
class BaseOptions:
name = None # type: str
description = None # type: str
@ -18,7 +18,7 @@ class BaseOptions(object):
def __setattr__(self, name, value):
if not self._frozen:
super(BaseOptions, self).__setattr__(name, value)
super().__setattr__(name, value)
else:
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.freeze()
cls._meta = _meta
super(BaseType, cls).__init_subclass_with_meta__()
super().__init_subclass_with_meta__()

View File

@ -1,4 +1,4 @@
class Context(object):
class Context:
"""
Context can be used to make a convenient container for attributes to provide
for execution for resolvers of a GraphQL operation like a query.

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
import datetime
from aniso8601 import parse_date, parse_datetime, parse_time

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
from decimal import Decimal as _Decimal
from graphql.language import ast

View File

@ -8,7 +8,7 @@ from graphql import (
)
class GrapheneGraphQLType(object):
class GrapheneGraphQLType:
"""
A class for extending the base GraphQLType with the related
graphene_type
@ -16,7 +16,7 @@ class GrapheneGraphQLType(object):
def __init__(self, *args, **kwargs):
self.graphene_type = kwargs.pop("graphene_type")
super(GrapheneGraphQLType, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
class GrapheneInterfaceType(GrapheneGraphQLType, GraphQLInterfaceType):

View File

@ -11,7 +11,7 @@ class Dynamic(MountedType):
"""
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)
self.type = type
self.with_schema = with_schema

View File

@ -50,7 +50,7 @@ class EnumMeta(SubclassWithMeta_Meta):
description=description,
deprecation_reason=deprecation_reason,
)
return super(EnumMeta, cls).__call__(*args, **kwargs)
return super().__call__(*args, **kwargs)
# return cls._meta.enum(*args, **kwargs)
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():
setattr(cls, key, value)
super(Enum, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod
def get_type(cls):

View File

@ -4,7 +4,7 @@ from collections import OrderedDict
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from collections.abc import Mapping
from functools import partial
@ -80,7 +80,7 @@ class Field(MountedType):
default_value=None,
**extra_args
):
super(Field, self).__init__(_creation_counter=_creation_counter)
super().__init__(_creation_counter=_creation_counter)
assert not args or isinstance(args, Mapping), (
'Arguments in a field have to be a mapping, received "{}".'
).format(args)

View File

@ -1,5 +1,3 @@
from __future__ import unicode_literals
from graphql.language.ast import (
BooleanValue,
FloatValue,

View File

@ -55,7 +55,7 @@ class InputField(MountedType):
_creation_counter=None,
**extra_args
):
super(InputField, self).__init__(_creation_counter=_creation_counter)
super().__init__(_creation_counter=_creation_counter)
self.name = name
if required:
type = NonNull(type)

View File

@ -81,7 +81,7 @@ class InputObjectType(UnmountedType, BaseType):
if container is None:
container = type(cls.__name__, (InputObjectTypeContainer, cls), {})
_meta.container = container
super(InputObjectType, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod
def get_type(cls):

View File

@ -60,7 +60,7 @@ class Interface(BaseType):
else:
_meta.fields = fields
super(Interface, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod
def resolve_type(cls, instance, info):

View File

@ -1,5 +1,3 @@
from __future__ import absolute_import
import json
from graphql.language import ast

View File

@ -129,7 +129,7 @@ class Mutation(ObjectType):
_meta.resolver = resolver
_meta.arguments = arguments
super(Mutation, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod
def Field(

View File

@ -126,7 +126,7 @@ class ObjectType(BaseType):
_meta.possible_types = possible_types
_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

View File

@ -22,7 +22,7 @@ class Scalar(UnmountedType, BaseType):
@classmethod
def __init_subclass_with_meta__(cls, **options):
_meta = ScalarOptions(cls)
super(Scalar, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
serialize = None
parse_value = None
@ -111,7 +111,7 @@ class String(Scalar):
@staticmethod
def coerce_string(value):
if isinstance(value, bool):
return u"true" if value else u"false"
return "true" if value else "false"
return str(value)
serialize = coerce_string

View File

@ -93,7 +93,7 @@ class Schema(GraphQLSchema):
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:
raise AttributeError('Type "{}" not found in the Schema'.format(type_name))
if isinstance(_type, GrapheneGraphQLType):

View File

@ -9,7 +9,7 @@ class Structure(UnmountedType):
"""
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):
cls_name = type(self).__name__
of_type_name = type(of_type).__name__
@ -84,7 +84,7 @@ class NonNull(Structure):
"""
def __init__(self, *args, **kwargs):
super(NonNull, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
assert not isinstance(self._of_type, NonNull), (
"Can only create NonNull of a Nullable GraphQLType but got: {}."
).format(self._of_type)

View File

@ -9,7 +9,7 @@ class CustomType(BaseType):
@classmethod
def __init_subclass_with_meta__(cls, **options):
_meta = CustomOptions(cls)
super(CustomType, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
def test_basetype():

View File

@ -281,7 +281,7 @@ def test_stringifies_simple_types():
def test_does_not_mutate_passed_field_definitions():
class CommonFields(object):
class CommonFields:
field1 = String()
field2 = String(id=String())
@ -293,7 +293,7 @@ def test_does_not_mutate_passed_field_definitions():
assert TestObject1._meta.fields == TestObject2._meta.fields
class CommonFields(object):
class CommonFields:
field1 = String()
field2 = String()

View File

@ -113,7 +113,6 @@ def test_enum_from_builtin_enum_accepts_lambda_description():
def test_enum_from_python3_enum_uses_enum_doc():
from enum import Enum as PyEnum
class Color(PyEnum):

View File

@ -9,7 +9,7 @@ from ..structures import NonNull
from .utils import MyLazyType
class MyInstance(object):
class MyInstance:
value = "value"
value_func = staticmethod(lambda: "value_func")

View File

@ -8,7 +8,7 @@ from ..schema import Schema
from ..unmountedtype import UnmountedType
class MyType(object):
class MyType:
pass
@ -78,7 +78,7 @@ def test_generate_inputobjecttype_as_argument():
def test_generate_inputobjecttype_inherit_abstracttype():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar(MyType)
class MyInputObjectType(InputObjectType, MyAbstractType):
@ -92,7 +92,7 @@ def test_generate_inputobjecttype_inherit_abstracttype():
def test_generate_inputobjecttype_inherit_abstracttype_reversed():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar(MyType)
class MyInputObjectType(MyAbstractType, InputObjectType):

View File

@ -3,7 +3,7 @@ from ..interface import Interface
from ..unmountedtype import UnmountedType
class MyType(object):
class MyType:
pass
@ -57,7 +57,7 @@ def test_generate_interface_unmountedtype():
def test_generate_interface_inherit_abstracttype():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar()
class MyInterface(Interface, MyAbstractType):
@ -80,7 +80,7 @@ def test_generate_interface_inherit_interface():
def test_generate_interface_inherit_abstracttype_reversed():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar()
class MyInterface(MyAbstractType, Interface):

View File

@ -5,7 +5,7 @@ from ..scalars import String
class CustomField(Field):
def __init__(self, *args, **kwargs):
self.metadata = kwargs.pop("metadata", None)
super(CustomField, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def test_mounted_type():

View File

@ -106,7 +106,7 @@ def test_ordered_fields_in_objecttype():
def test_generate_objecttype_inherit_abstracttype():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar()
class MyObjectType(ObjectType, MyAbstractType):
@ -120,7 +120,7 @@ def test_generate_objecttype_inherit_abstracttype():
def test_generate_objecttype_inherit_abstracttype_reversed():
class MyAbstractType(object):
class MyAbstractType:
field1 = MyScalar()
class MyObjectType(MyAbstractType, ObjectType):

View File

@ -28,7 +28,7 @@ def test_query():
def test_query_source():
class Root(object):
class Root:
_hello = "World"
def hello(self):
@ -45,10 +45,10 @@ def test_query_source():
def test_query_union():
class one_object(object):
class one_object:
pass
class two_object(object):
class two_object:
pass
class One(ObjectType):
@ -83,10 +83,10 @@ def test_query_union():
def test_query_interface():
class one_object(object):
class one_object:
pass
class two_object(object):
class two_object:
pass
class MyInterface(Interface):

View File

@ -13,7 +13,7 @@ info = None
demo_dict = {"attr": "value"}
class demo_obj(object):
class demo_obj:
attr = "value"

View File

@ -38,7 +38,7 @@ def test_serializes_output_string():
assert String.serialize(-1.1) == "-1.1"
assert String.serialize(True) == "true"
assert String.serialize(False) == "false"
assert String.serialize(u"\U0001F601") == u"\U0001F601"
assert String.serialize("\U0001F601") == "\U0001F601"
def test_serializes_output_boolean():

View File

@ -77,7 +77,7 @@ class TypeMap(GraphQLTypeMap):
def __init__(self, types, auto_camelcase=True, schema=None):
self.auto_camelcase = auto_camelcase
self.schema = schema
super(TypeMap, self).__init__(types)
super().__init__(types)
def reducer(self, map, type):
if not type:

View File

@ -57,7 +57,7 @@ class Union(UnmountedType, BaseType):
_meta = UnionOptions(cls)
_meta.types = types
super(Union, cls).__init_subclass_with_meta__(_meta=_meta, **options)
super().__init_subclass_with_meta__(_meta=_meta, **options)
@classmethod
def get_type(cls):

View File

@ -40,7 +40,7 @@ class UnmountedType(OrderedType):
"""
def __init__(self, *args, **kwargs):
super(UnmountedType, self).__init__()
super().__init__()
self.args = args
self.kwargs = kwargs

View File

@ -1,4 +1,3 @@
from __future__ import absolute_import
from uuid import UUID as _UUID
from graphql.language import ast

View File

@ -3,7 +3,7 @@ import json
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from collections.abc import Mapping
def to_key(value):

View File

@ -3,7 +3,7 @@ from collections import OrderedDict
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from collections.abc import Mapping
def deflate(node, index=None, path=None):

View File

@ -2,7 +2,7 @@ import functools
import inspect
import warnings
string_types = (type(b""), type(u""))
string_types = (bytes, str)
def warn_deprecation(text):
@ -17,7 +17,6 @@ def deprecated(reason):
"""
if isinstance(reason, string_types):
# The @deprecated is used with a 'reason'.
#
# .. code-block:: python
@ -27,7 +26,6 @@ def deprecated(reason):
# pass
def decorator(func1):
if inspect.isclass(func1):
fmt1 = "Call to deprecated class {name} ({reason})."
else:
@ -43,7 +41,6 @@ def deprecated(reason):
return decorator
elif inspect.isclass(reason) or inspect.isfunction(reason):
# The @deprecated is used without any 'reason'.
#
# .. code-block:: python

View File

@ -2,7 +2,7 @@ from functools import total_ordering
@total_ordering
class OrderedType(object):
class OrderedType:
creation_counter = 1
def __init__(self, _creation_counter=None):
@ -36,4 +36,4 @@ class OrderedType(object):
return NotImplemented
def __hash__(self):
return hash((self.creation_counter))
return hash(self.creation_counter)

View File

@ -2,7 +2,7 @@ class _OldClass:
pass
class _NewClass(object):
class _NewClass:
pass

View File

@ -1,4 +1,3 @@
# coding: utf-8
from ..str_converters import to_camel_case, to_const, to_snake_case

View File

@ -2,7 +2,7 @@ from ..trim_docstring import trim_docstring
def test_trim_docstring():
class WellDocumentedObject(object):
class WellDocumentedObject:
"""
This object is very well-documented. It has multiple lines in its
description.
@ -16,7 +16,7 @@ def test_trim_docstring():
"description.\n\nMultiple paragraphs too"
)
class UndocumentedObject(object):
class UndocumentedObject:
pass
assert trim_docstring(UndocumentedObject.__doc__) is None

View File

@ -9,7 +9,7 @@ try:
from promise import Promise, is_thenable # type: ignore
except ImportError:
class Promise(object): # type: ignore
class Promise: # type: ignore
pass
def is_thenable(obj): # type: ignore

View File

@ -6,7 +6,7 @@ from graphene.types.scalars import String
from graphene.relay.mutation import ClientIDMutation
class SharedFields(object):
class SharedFields:
shared = String()