diff --git a/.travis.yml b/.travis.yml index 89b17c0c..b1ab41ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ python: - 2.7 - 3.4 - 3.5 -- pypy before_install: - | if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then diff --git a/graphene/relay/mutation.py b/graphene/relay/mutation.py index 8db462d6..eb444eed 100644 --- a/graphene/relay/mutation.py +++ b/graphene/relay/mutation.py @@ -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))) diff --git a/graphene/relay/node.py b/graphene/relay/node.py index aa6e2dc0..f3c08a5d 100644 --- a/graphene/relay/node.py +++ b/graphene/relay/node.py @@ -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: diff --git a/graphene/types/datetime.py b/graphene/types/datetime.py index 0a0e3343..b11671f9 100644 --- a/graphene/types/datetime.py +++ b/graphene/types/datetime.py @@ -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."