mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-26 11:33:55 +03:00
Removed unused code
This commit is contained in:
parent
f0edcb224a
commit
b78b8c4134
|
@ -1,5 +1,6 @@
|
|||
from ..pyutils.init_subclass import InitSubclassMeta
|
||||
|
||||
|
||||
class AbstractType(object):
|
||||
__metaclass__ = InitSubclassMeta
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@ class ObjectTypeOptions(BaseOptions):
|
|||
interfaces = () # type: List[Type[Interface]]
|
||||
|
||||
|
||||
class ObjectTypeMeta(type):
|
||||
pass
|
||||
|
||||
class ObjectType(BaseType):
|
||||
'''
|
||||
Object Type Definition
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
import inspect
|
||||
|
||||
from ..utils.props import props
|
||||
|
||||
|
||||
class Options(object):
|
||||
'''
|
||||
This is the class wrapper around Meta.
|
||||
It helps to validate and cointain the attributes inside
|
||||
'''
|
||||
|
||||
def __init__(self, meta=None, **defaults):
|
||||
if meta:
|
||||
assert inspect.isclass(meta), (
|
||||
'Meta have to be a class, received "{}".'.format(repr(meta))
|
||||
)
|
||||
|
||||
meta_attrs = props(meta) if meta else {}
|
||||
for attr_name, value in defaults.items():
|
||||
if attr_name in meta_attrs:
|
||||
value = meta_attrs.pop(attr_name)
|
||||
setattr(self, attr_name, value)
|
||||
|
||||
# If meta_attrs is not empty, it implicitly means
|
||||
# it received invalid attributes
|
||||
if meta_attrs:
|
||||
raise TypeError(
|
||||
"Invalid attributes: {}".format(
|
||||
', '.join(sorted(meta_attrs.keys()))
|
||||
)
|
||||
)
|
||||
|
||||
def extend_with_defaults(self, defaults):
|
||||
for attr_name, value in defaults.items():
|
||||
if not hasattr(self, attr_name):
|
||||
setattr(self, attr_name, value)
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
options_props = props(self)
|
||||
props_as_attrs = ' '.join(['{}={}'.format(key, value) for key, value in options_props.items()])
|
||||
return '<Options {}>'.format(props_as_attrs)
|
Loading…
Reference in New Issue
Block a user