mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-29 17:29:51 +03:00
minor tweaks
This commit is contained in:
parent
c2e0a41617
commit
e88b050694
|
@ -45,13 +45,9 @@ def get_complete_version(version=None):
|
||||||
from graphene import VERSION as version
|
from graphene import VERSION as version
|
||||||
else:
|
else:
|
||||||
if len(version) is not 5:
|
if len(version) is not 5:
|
||||||
raise AssertionError(
|
raise AssertionError("Version needs to be 5")
|
||||||
"Version needs to be 5"
|
if version[3] not in ("alpha", "beta", "rc", "final"):
|
||||||
)
|
raise AssertionError("Release version is unkown")
|
||||||
if version[3] not in ('alpha', 'beta', 'rc', 'final'):
|
|
||||||
raise AssertionError(
|
|
||||||
"Release version is unkown"
|
|
||||||
)
|
|
||||||
|
|
||||||
return version
|
return version
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,14 @@ class Connection(ObjectType):
|
||||||
_meta = ConnectionOptions(cls)
|
_meta = ConnectionOptions(cls)
|
||||||
if not node:
|
if not node:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"You have to provide a node in {}.Meta"
|
"You have to provide a node in {}.Meta".format(cls.__name__)
|
||||||
.format(cls.__name__)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not issubclass(node, (Scalar, Enum, ObjectType, Interface, Union, NonNull)):
|
if not issubclass(node, (Scalar, Enum, ObjectType, Interface, Union, NonNull)):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Received incompatible node "{}" for Connection {}.'
|
'Received incompatible node "{}" for Connection {}.'.format(
|
||||||
.format(node, cls.__name__)
|
node, cls.__name__
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
base_name = re.sub("Connection$", "", name or cls.__name__) or node._meta.name
|
base_name = re.sub("Connection$", "", name or cls.__name__) or node._meta.name
|
||||||
|
@ -114,8 +114,9 @@ class IterableConnectionField(Field):
|
||||||
|
|
||||||
if not issubclass(connection_type, Connection):
|
if not issubclass(connection_type, Connection):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'{} type have to be a subclass of Connection. Received "{}".'
|
'{} type have to be a subclass of Connection. Received "{}".'.format(
|
||||||
.format(self.__class__.__name__, connection_type)
|
self.__class__.__name__, connection_type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return type
|
return type
|
||||||
|
|
||||||
|
@ -126,11 +127,12 @@ class IterableConnectionField(Field):
|
||||||
|
|
||||||
if not isinstance(resolved, Iterable):
|
if not isinstance(resolved, Iterable):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'''
|
"""
|
||||||
Resolved value from the connection field have to be iterable or instance of {}.
|
Resolved value from the connection field have to be iterable or instance of {}.
|
||||||
Received "{}"
|
Received "{}"
|
||||||
'''
|
""".format(
|
||||||
.format(connection_type, resolved)
|
connection_type, resolved
|
||||||
|
)
|
||||||
)
|
)
|
||||||
connection = connection_from_list(
|
connection = connection_from_list(
|
||||||
resolved,
|
resolved,
|
||||||
|
|
|
@ -47,8 +47,9 @@ class ClientIDMutation(Mutation):
|
||||||
if cls.mutate and cls.mutate.__func__ == ClientIDMutation.mutate.__func__:
|
if cls.mutate and cls.mutate.__func__ == ClientIDMutation.mutate.__func__:
|
||||||
if not mutate_and_get_payload:
|
if not mutate_and_get_payload:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"{name}.mutate_and_get_payload method is required in a ClientIDMutation."
|
"{name}.mutate_and_get_payload method is required in a ClientIDMutation.".format(
|
||||||
.format(name=name or cls.__name__)
|
name=name or cls.__name__
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
|
|
|
@ -48,11 +48,9 @@ class GlobalID(Field):
|
||||||
|
|
||||||
|
|
||||||
class NodeField(Field):
|
class NodeField(Field):
|
||||||
|
def __init__(self, node, type=False, deprecation_reason=None, name=None, **kwargs):
|
||||||
def __init__(self, node, type=False, deprecation_reason=None,
|
|
||||||
name=None, **kwargs):
|
|
||||||
if not issubclass(node, Node):
|
if not issubclass(node, Node):
|
||||||
raise AssertionError('NodeField can only operate in Nodes')
|
raise AssertionError("NodeField can only operate in Nodes")
|
||||||
self.node_type = node
|
self.node_type = node
|
||||||
self.field_type = type
|
self.field_type = type
|
||||||
|
|
||||||
|
@ -103,8 +101,7 @@ class Node(AbstractNode):
|
||||||
if only_type:
|
if only_type:
|
||||||
if graphene_type != only_type:
|
if graphene_type != only_type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Must receive a {} id.'
|
"Must receive a {} id.".format(only_type._meta.name)
|
||||||
.format(only_type._meta.name)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# We make sure the ObjectType implements the "Node" interface
|
# We make sure the ObjectType implements the "Node" interface
|
||||||
|
|
|
@ -75,8 +75,7 @@ def to_arguments(args, extra_args=None):
|
||||||
arg_name = default_name or arg.name
|
arg_name = default_name or arg.name
|
||||||
if arg_name in arguments:
|
if arg_name in arguments:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'More than one Argument have same name "{}".'
|
'More than one Argument have same name "{}".'.format(arg_name)
|
||||||
.format(arg_name)
|
|
||||||
)
|
)
|
||||||
arguments[arg_name] = arg
|
arguments[arg_name] = arg
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,7 @@ class Date(Scalar):
|
||||||
if isinstance(date, datetime.datetime):
|
if isinstance(date, datetime.datetime):
|
||||||
date = date.date()
|
date = date.date()
|
||||||
if not isinstance(date, datetime.date):
|
if not isinstance(date, datetime.date):
|
||||||
raise AssertionError(
|
raise AssertionError('Received not compatible date "{}"'.format(repr(date)))
|
||||||
'Received not compatible date "{}"'
|
|
||||||
.format(repr(date))
|
|
||||||
)
|
|
||||||
return date.isoformat()
|
return date.isoformat()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -50,8 +47,7 @@ class DateTime(Scalar):
|
||||||
def serialize(dt):
|
def serialize(dt):
|
||||||
if not isinstance(dt, (datetime.datetime, datetime.date)):
|
if not isinstance(dt, (datetime.datetime, datetime.date)):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Received not compatible datetime "{}"'
|
'Received not compatible datetime "{}"'.format(repr(dt))
|
||||||
.format(repr(dt))
|
|
||||||
)
|
)
|
||||||
return dt.isoformat()
|
return dt.isoformat()
|
||||||
|
|
||||||
|
@ -78,10 +74,7 @@ class Time(Scalar):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def serialize(time):
|
def serialize(time):
|
||||||
if not isinstance(time, datetime.time):
|
if not isinstance(time, datetime.time):
|
||||||
raise AssertionError(
|
raise AssertionError('Received not compatible time "{}"'.format(repr(time)))
|
||||||
'Received not compatible time "{}"'
|
|
||||||
.format(repr(time))
|
|
||||||
)
|
|
||||||
return time.isoformat()
|
return time.isoformat()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Dynamic(MountedType):
|
||||||
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
|
super(Dynamic, self).__init__(_creation_counter=_creation_counter)
|
||||||
if not (inspect.isfunction(type) or isinstance(type, partial)):
|
if not (inspect.isfunction(type) or isinstance(type, partial)):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'type is expected to be a function or an instance of partial'
|
"type is expected to be a function or an instance of partial"
|
||||||
)
|
)
|
||||||
self.type = type
|
self.type = type
|
||||||
self.with_schema = with_schema
|
self.with_schema = with_schema
|
||||||
|
|
|
@ -37,17 +37,17 @@ class Field(MountedType):
|
||||||
|
|
||||||
if args and not isinstance(args, Mapping):
|
if args and not isinstance(args, Mapping):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Arguments in a field have to be a mapping, received "{}".'
|
'Arguments in a field have to be a mapping, received "{}".'.format(args)
|
||||||
.format(args)
|
|
||||||
)
|
)
|
||||||
if source and resolver:
|
if source and resolver:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'A Field cannot have a source and a resolver in at the same time.'
|
"A Field cannot have a source and a resolver in at the same time."
|
||||||
)
|
)
|
||||||
if callable(default_value):
|
if callable(default_value):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'The default value can not be a function but received "{}".'
|
'The default value can not be a function but received "{}".'.format(
|
||||||
.format(base_type(default_value))
|
base_type(default_value)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if required:
|
if required:
|
||||||
|
|
|
@ -10,9 +10,8 @@ class MountedType(OrderedType):
|
||||||
"""
|
"""
|
||||||
if not isinstance(unmounted, UnmountedType):
|
if not isinstance(unmounted, UnmountedType):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"{} can't mount {}"
|
"{} can't mount {}".format(cls.__name__, repr(unmounted))
|
||||||
.format(cls.__name__, repr(unmounted))
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
unmounted.get_type(),
|
unmounted.get_type(),
|
||||||
|
|
|
@ -49,11 +49,12 @@ class ObjectType(BaseType):
|
||||||
|
|
||||||
if possible_types and cls.is_type_of:
|
if possible_types and cls.is_type_of:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'''
|
"""
|
||||||
{name}.Meta.possible_types will cause type collision with {name}.is_type_of.
|
{name}.Meta.possible_types will cause type collision with {name}.is_type_of.
|
||||||
Please use one or other.
|
Please use one or other.
|
||||||
'''
|
""".format(
|
||||||
.format(name=cls.__name__)
|
name=cls.__name__
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if _meta.fields:
|
if _meta.fields:
|
||||||
|
|
|
@ -12,7 +12,7 @@ default_resolver = attr_resolver
|
||||||
def set_default_resolver(resolver):
|
def set_default_resolver(resolver):
|
||||||
global default_resolver
|
global default_resolver
|
||||||
if not callable(resolver):
|
if not callable(resolver):
|
||||||
raise AssertionError('Received non-callable resolver.')
|
raise AssertionError("Received non-callable resolver.")
|
||||||
default_resolver = resolver
|
default_resolver = resolver
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ def assert_valid_root_type(_type):
|
||||||
is_graphene_objecttype = inspect.isclass(_type) and issubclass(_type, ObjectType)
|
is_graphene_objecttype = inspect.isclass(_type) and issubclass(_type, ObjectType)
|
||||||
is_graphql_objecttype = isinstance(_type, GraphQLObjectType)
|
is_graphql_objecttype = isinstance(_type, GraphQLObjectType)
|
||||||
if not (is_graphene_objecttype or is_graphql_objecttype):
|
if not (is_graphene_objecttype or is_graphql_objecttype):
|
||||||
raise AssertionError(
|
raise AssertionError("Type {} is not a valid ObjectType.".format(_type))
|
||||||
"Type {} is not a valid ObjectType."
|
|
||||||
.format(_type)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Schema(GraphQLSchema):
|
class Schema(GraphQLSchema):
|
||||||
|
@ -57,8 +54,9 @@ class Schema(GraphQLSchema):
|
||||||
|
|
||||||
if not all(isinstance(d, GraphQLDirective) for d in directives):
|
if not all(isinstance(d, GraphQLDirective) for d in directives):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Schema directives must be List[GraphQLDirective] if provided but got: {}.'
|
"Schema directives must be List[GraphQLDirective] if provided but got: {}.".format(
|
||||||
.format(directives)
|
directives
|
||||||
|
)
|
||||||
)
|
)
|
||||||
self._directives = directives
|
self._directives = directives
|
||||||
self.build_typemap()
|
self.build_typemap()
|
||||||
|
@ -81,10 +79,7 @@ class Schema(GraphQLSchema):
|
||||||
"""
|
"""
|
||||||
_type = super(Schema, self).get_type(type_name)
|
_type = super(Schema, self).get_type(type_name)
|
||||||
if _type is None:
|
if _type is None:
|
||||||
raise AttributeError(
|
raise AttributeError('Type "{}" not found in the Schema'.format(type_name))
|
||||||
'Type "{}" not found in the Schema'
|
|
||||||
.format(type_name)
|
|
||||||
)
|
|
||||||
if isinstance(_type, GrapheneGraphQLType):
|
if isinstance(_type, GrapheneGraphQLType):
|
||||||
return _type.graphene_type
|
return _type.graphene_type
|
||||||
return _type
|
return _type
|
||||||
|
@ -98,13 +93,13 @@ class Schema(GraphQLSchema):
|
||||||
graphql_type = self.get_type(_type._meta.name)
|
graphql_type = self.get_type(_type._meta.name)
|
||||||
if not graphql_type:
|
if not graphql_type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"Type {} not found in this schema."
|
"Type {} not found in this schema.".format(_type._meta.name)
|
||||||
.format(_type._meta.name)
|
|
||||||
)
|
)
|
||||||
if graphql_type.graphene_type != _type:
|
if graphql_type.graphene_type != _type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'The type {} does not match with the associated graphene type {}.'
|
"The type {} does not match with the associated graphene type {}.".format(
|
||||||
.format(_type, graphql_type.graphene_type)
|
_type, graphql_type.graphene_type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return graphql_type
|
return graphql_type
|
||||||
raise Exception("{} is not a valid GraphQL type.".format(_type))
|
raise Exception("{} is not a valid GraphQL type.".format(_type))
|
||||||
|
|
|
@ -7,7 +7,6 @@ from ..scalars import String
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
from ..structures import NonNull
|
from ..structures import NonNull
|
||||||
from ..unmountedtype import UnmountedType
|
from ..unmountedtype import UnmountedType
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
class MyType(Interface):
|
class MyType(Interface):
|
||||||
|
@ -229,14 +228,15 @@ def test_objecttype_with_possible_types_and_is_type_of_should_raise():
|
||||||
def is_type_of(cls, root, context, info):
|
def is_type_of(cls, root, context, info):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
assertion_message = '''
|
assertion_message = """
|
||||||
MyObjectType.Meta.possible_types will cause type collision with MyObjectType.is_type_of.
|
MyObjectType.Meta.possible_types will cause type collision with MyObjectType.is_type_of.
|
||||||
Please use one or other.
|
Please use one or other.
|
||||||
'''
|
"""
|
||||||
space_removed_excinfo = str(excinfo.value).replace(" ", "")
|
space_removed_excinfo = str(excinfo.value).replace(" ", "")
|
||||||
space_removed_assertion_message = assertion_message.replace(" ", "")
|
space_removed_assertion_message = assertion_message.replace(" ", "")
|
||||||
assert space_removed_assertion_message == space_removed_excinfo
|
assert space_removed_assertion_message == space_removed_excinfo
|
||||||
|
|
||||||
|
|
||||||
def test_objecttype_no_fields_output():
|
def test_objecttype_no_fields_output():
|
||||||
class User(ObjectType):
|
class User(ObjectType):
|
||||||
name = String()
|
name = String()
|
||||||
|
|
|
@ -62,13 +62,13 @@ def resolve_type(resolve_type_func, map, type_name, root, info):
|
||||||
graphql_type = map.get(_type._meta.name)
|
graphql_type = map.get(_type._meta.name)
|
||||||
if not graphql_type:
|
if not graphql_type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"Can't find type {} in schema"
|
"Can't find type {} in schema".format(_type._meta.name)
|
||||||
.format(_type._meta.name)
|
|
||||||
)
|
)
|
||||||
if graphql_type.graphene_type != _type:
|
if graphql_type.graphene_type != _type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'The type {} does not match with the associated graphene type {}.'
|
"The type {} does not match with the associated graphene type {}.".format(
|
||||||
.format(_type, graphql_type.graphene_type)
|
_type, graphql_type.graphene_type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return graphql_type
|
return graphql_type
|
||||||
|
|
||||||
|
@ -102,8 +102,9 @@ class TypeMap(GraphQLTypeMap):
|
||||||
if isinstance(_type, GrapheneGraphQLType):
|
if isinstance(_type, GrapheneGraphQLType):
|
||||||
if _type.graphene_type is not type:
|
if _type.graphene_type is not type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Found different types with the same name in the schema: {}, {}.'
|
"Found different types with the same name in the schema: {}, {}.".format(
|
||||||
.format(_type.graphene_type, type)
|
_type.graphene_type, type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return map
|
return map
|
||||||
|
|
||||||
|
@ -183,8 +184,9 @@ class TypeMap(GraphQLTypeMap):
|
||||||
if isinstance(_type, GrapheneGraphQLType):
|
if isinstance(_type, GrapheneGraphQLType):
|
||||||
if _type.graphene_type != type:
|
if _type.graphene_type != type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Found different types with the same name in the schema: {}, {}.'
|
"Found different types with the same name in the schema: {}, {}.".format(
|
||||||
.format(_type.graphene_type, type)
|
_type.graphene_type, type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return _type
|
return _type
|
||||||
|
|
||||||
|
@ -195,8 +197,9 @@ class TypeMap(GraphQLTypeMap):
|
||||||
internal_type = map[interface._meta.name]
|
internal_type = map[interface._meta.name]
|
||||||
if internal_type.graphene_type != interface:
|
if internal_type.graphene_type != interface:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Found different types with the same name in the schema: {}, {}.'
|
"Found different types with the same name in the schema: {}, {}.".format(
|
||||||
.format(internal_type.graphene_type, interface)
|
internal_type.graphene_type, interface
|
||||||
|
)
|
||||||
)
|
)
|
||||||
interfaces.append(internal_type)
|
interfaces.append(internal_type)
|
||||||
return interfaces
|
return interfaces
|
||||||
|
@ -223,8 +226,9 @@ class TypeMap(GraphQLTypeMap):
|
||||||
if isinstance(_type, GrapheneInterfaceType):
|
if isinstance(_type, GrapheneInterfaceType):
|
||||||
if _type.graphene_type != type:
|
if _type.graphene_type != type:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'Found different types with the same name in the schema: {}, {}.'
|
"Found different types with the same name in the schema: {}, {}.".format(
|
||||||
.format(_type.graphene_type, type)
|
_type.graphene_type, type
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return _type
|
return _type
|
||||||
|
|
||||||
|
@ -266,8 +270,9 @@ class TypeMap(GraphQLTypeMap):
|
||||||
internal_type = map[objecttype._meta.name]
|
internal_type = map[objecttype._meta.name]
|
||||||
if internal_type.graphene_type != objecttype:
|
if internal_type.graphene_type != objecttype:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"Found different types with the same name in the schema: {}, {}."
|
"Found different types with the same name in the schema: {}, {}.".format(
|
||||||
.format(internal_type.graphene_type, objecttype)
|
internal_type.graphene_type, objecttype
|
||||||
|
)
|
||||||
)
|
)
|
||||||
union_types.append(internal_type)
|
union_types.append(internal_type)
|
||||||
return union_types
|
return union_types
|
||||||
|
|
|
@ -25,8 +25,7 @@ class Union(UnmountedType, BaseType):
|
||||||
def __init_subclass_with_meta__(cls, types=None, **options):
|
def __init_subclass_with_meta__(cls, types=None, **options):
|
||||||
if not (isinstance(types, (list, tuple)) and len(types) > 0):
|
if not (isinstance(types, (list, tuple)) and len(types) > 0):
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
"Must provide types for Union {name}."
|
"Must provide types for Union {name}.".format(name=cls.__name__)
|
||||||
.format(name=cls.__name__)
|
|
||||||
)
|
)
|
||||||
_meta = UnionOptions(cls)
|
_meta = UnionOptions(cls)
|
||||||
_meta.types = types
|
_meta.types = types
|
||||||
|
|
|
@ -15,10 +15,7 @@ class UUID(Scalar):
|
||||||
if isinstance(uuid, str):
|
if isinstance(uuid, str):
|
||||||
uuid = _UUID(uuid)
|
uuid = _UUID(uuid)
|
||||||
if not isinstance(uuid, _UUID):
|
if not isinstance(uuid, _UUID):
|
||||||
raise AssertionError(
|
raise AssertionError("Expected UUID instance, received {}".format(uuid))
|
||||||
"Expected UUID instance, received {}"
|
|
||||||
.format(uuid)
|
|
||||||
)
|
|
||||||
return str(uuid)
|
return str(uuid)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -22,10 +22,11 @@ def annotate(_func=None, _trigger_warning=True, **annotations):
|
||||||
|
|
||||||
# We make sure the annotations are valid
|
# We make sure the annotations are valid
|
||||||
for key, value in annotations.items():
|
for key, value in annotations.items():
|
||||||
if not key in func_signature.parameters:
|
if func_signature.parameters.get(key, None) is None:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'The key {key} is not a function parameter in the function "{func_name}".'
|
'The key {key} is not a function parameter in the function "{func_name}".'.format(
|
||||||
.format(key=key, func_name=func_name(_func))
|
key=key, func_name=func_name(_func)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func_annotations = getattr(_func, "__annotations__", None)
|
func_annotations = getattr(_func, "__annotations__", None)
|
||||||
|
|
|
@ -44,11 +44,12 @@ class SubclassWithMeta(six.with_metaclass(SubclassWithMeta_Meta)):
|
||||||
if abstract:
|
if abstract:
|
||||||
if options:
|
if options:
|
||||||
raise AssertionError(
|
raise AssertionError(
|
||||||
'''
|
"""
|
||||||
Abstract types can only contain the abstract attribute.
|
Abstract types can only contain the abstract attribute.
|
||||||
Received: abstract, {option_keys}
|
Received: abstract, {option_keys}
|
||||||
'''
|
""".format(
|
||||||
.format(option_keys=', '.join(options.keys()))
|
option_keys=", ".join(options.keys())
|
||||||
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
super_class = super(cls, cls)
|
super_class = super(cls, cls)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user