mirror of
https://github.com/graphql-python/graphene.git
synced 2025-09-21 11:22:33 +03:00
Remove object as base class (not needed in Py 3)
This commit is contained in:
parent
a18c226155
commit
029dde32a2
|
@ -66,7 +66,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")
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -14,7 +14,7 @@ from ...types.scalars import String
|
|||
from ..mutation import ClientIDMutation
|
||||
|
||||
|
||||
class SharedFields(object):
|
||||
class SharedFields:
|
||||
shared = String()
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ class SaySomething(ClientIDMutation):
|
|||
return SaySomething(phrase=str(what))
|
||||
|
||||
|
||||
class FixedSaySomething(object):
|
||||
class FixedSaySomething:
|
||||
__slots__ = ("phrase",)
|
||||
|
||||
def __init__(self, phrase):
|
||||
|
|
|
@ -6,7 +6,7 @@ from ...types import ObjectType, Schema, String
|
|||
from ..node import Node, is_node
|
||||
|
||||
|
||||
class SharedNodeFields(object):
|
||||
class SharedNodeFields:
|
||||
|
||||
shared = String()
|
||||
something_else = String()
|
||||
|
|
|
@ -20,7 +20,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
|
||||
|
|
|
@ -4,7 +4,7 @@ from ..utils.subclass_with_meta import SubclassWithMeta
|
|||
from ..utils.trim_docstring import trim_docstring
|
||||
|
||||
|
||||
class BaseOptions(object):
|
||||
class BaseOptions:
|
||||
name = None # type: str
|
||||
description = None # type: str
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Context(object):
|
||||
class Context:
|
||||
def __init__(self, **params):
|
||||
for key, value in params.items():
|
||||
setattr(self, key, value)
|
||||
|
|
|
@ -289,7 +289,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())
|
||||
|
||||
|
@ -301,7 +301,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()
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -34,7 +34,7 @@ def test_query():
|
|||
|
||||
|
||||
def test_query_source():
|
||||
class Root(object):
|
||||
class Root:
|
||||
_hello = "World"
|
||||
|
||||
def hello(self):
|
||||
|
@ -51,10 +51,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):
|
||||
|
@ -89,10 +89,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):
|
||||
|
|
|
@ -13,7 +13,7 @@ info = None
|
|||
demo_dict = {"attr": "value"}
|
||||
|
||||
|
||||
class demo_obj(object):
|
||||
class demo_obj:
|
||||
attr = "value"
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -2,7 +2,7 @@ class _OldClass:
|
|||
pass
|
||||
|
||||
|
||||
class _NewClass(object):
|
||||
class _NewClass:
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user