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)
|
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")
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -14,7 +14,7 @@ from ...types.scalars import String
|
||||||
from ..mutation import ClientIDMutation
|
from ..mutation import ClientIDMutation
|
||||||
|
|
||||||
|
|
||||||
class SharedFields(object):
|
class SharedFields:
|
||||||
shared = String()
|
shared = String()
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,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,7 +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()
|
||||||
|
|
|
@ -20,7 +20,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
|
||||||
|
|
|
@ -4,7 +4,7 @@ from ..utils.subclass_with_meta import SubclassWithMeta
|
||||||
from ..utils.trim_docstring import trim_docstring
|
from ..utils.trim_docstring import trim_docstring
|
||||||
|
|
||||||
|
|
||||||
class BaseOptions(object):
|
class BaseOptions:
|
||||||
name = None # type: str
|
name = None # type: str
|
||||||
description = None # type: str
|
description = None # type: str
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Context(object):
|
class Context:
|
||||||
def __init__(self, **params):
|
def __init__(self, **params):
|
||||||
for key, value in params.items():
|
for key, value in params.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
|
@ -289,7 +289,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())
|
||||||
|
|
||||||
|
@ -301,7 +301,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()
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -34,7 +34,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):
|
||||||
|
@ -51,10 +51,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):
|
||||||
|
@ -89,10 +89,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"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -2,7 +2,7 @@ class _OldClass:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _NewClass(object):
|
class _NewClass:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user