mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-23 15:10:48 +03:00
Fixed lint issues and pypy install
This commit is contained in:
parent
48507b9a0f
commit
4775755e48
|
@ -4,7 +4,6 @@ python:
|
|||
- 2.7
|
||||
- 3.4
|
||||
- 3.5
|
||||
- pypy
|
||||
before_install:
|
||||
- |
|
||||
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
|
||||
|
|
|
@ -23,7 +23,8 @@ class ClientIDMutationMeta(ObjectTypeMeta):
|
|||
base_name = re.sub('Payload$', '', name)
|
||||
if 'client_mutation_id' not in attrs:
|
||||
attrs['client_mutation_id'] = String(name='clientMutationId')
|
||||
cls = ObjectTypeMeta.__new__(cls, '{}Payload'.format(base_name), bases, attrs)
|
||||
cls = ObjectTypeMeta.__new__(
|
||||
cls, '{}Payload'.format(base_name), bases, attrs)
|
||||
mutate_and_get_payload = getattr(cls, 'mutate_and_get_payload', None)
|
||||
if cls.mutate and cls.mutate.__func__ == ClientIDMutation.mutate.__func__:
|
||||
assert mutate_and_get_payload, (
|
||||
|
@ -39,8 +40,10 @@ class ClientIDMutationMeta(ObjectTypeMeta):
|
|||
else:
|
||||
bases += (input_class, )
|
||||
input_attrs['client_mutation_id'] = String(name='clientMutationId')
|
||||
cls.Input = type('{}Input'.format(base_name), bases + (InputObjectType,), input_attrs)
|
||||
cls.Field = partial(Field, cls, resolver=cls.mutate, input=Argument(cls.Input, required=True))
|
||||
cls.Input = type('{}Input'.format(base_name), bases +
|
||||
(InputObjectType,), input_attrs)
|
||||
cls.Field = partial(Field, cls, resolver=cls.mutate,
|
||||
input=Argument(cls.Input, required=True))
|
||||
return cls
|
||||
|
||||
|
||||
|
@ -53,7 +56,7 @@ class ClientIDMutation(six.with_metaclass(ClientIDMutationMeta, ObjectType)):
|
|||
def on_resolve(payload):
|
||||
try:
|
||||
payload.client_mutation_id = input.get('clientMutationId')
|
||||
except:
|
||||
except Exception:
|
||||
raise Exception((
|
||||
'Cannot set client_mutation_id in the payload object {}'
|
||||
).format(repr(payload)))
|
||||
|
|
|
@ -55,7 +55,8 @@ class NodeMeta(InterfaceMeta):
|
|||
|
||||
def __new__(cls, name, bases, attrs):
|
||||
cls = InterfaceMeta.__new__(cls, name, bases, attrs)
|
||||
cls._meta.fields['id'] = GlobalID(cls, description='The ID of the object.')
|
||||
cls._meta.fields['id'] = GlobalID(
|
||||
cls, description='The ID of the object.')
|
||||
return cls
|
||||
|
||||
|
||||
|
@ -68,7 +69,8 @@ class NodeField(Field):
|
|||
self.field_type = type
|
||||
|
||||
super(NodeField, self).__init__(
|
||||
# If we don's specify a type, the field type will be the node interface
|
||||
# If we don's specify a type, the field type will be the node
|
||||
# interface
|
||||
type or node,
|
||||
description='The ID of the object',
|
||||
id=ID(required=True)
|
||||
|
@ -94,7 +96,7 @@ class Node(six.with_metaclass(NodeMeta, Interface)):
|
|||
try:
|
||||
_type, _id = cls.from_global_id(global_id)
|
||||
graphene_type = info.schema.get_type(_type).graphene_type
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
if only_type:
|
||||
|
|
|
@ -8,7 +8,7 @@ from .scalars import Scalar
|
|||
|
||||
try:
|
||||
import iso8601
|
||||
except:
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"iso8601 package is required for DateTime Scalar.\n"
|
||||
"You can install it using: pip install iso8601."
|
||||
|
|
Loading…
Reference in New Issue
Block a user