Compare commits

...

3 Commits

Author SHA1 Message Date
Syrus Akbary
6f76882397 Updated version to 1.4.2 2017-10-28 11:12:30 -07:00
Syrus Akbary
4775755e48 Fixed lint issues and pypy install 2017-10-28 10:59:13 -07:00
Syrus Akbary
48507b9a0f Pin requirements for Graphene 1.4.2
Pin requirements for Graphene 1.4.2
2017-10-28 10:55:53 -07:00
6 changed files with 19 additions and 14 deletions

View File

@ -4,7 +4,6 @@ python:
- 2.7
- 3.4
- 3.5
- pypy
before_install:
- |
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then

View File

@ -10,7 +10,7 @@ except NameError:
__SETUP__ = False
VERSION = (1, 4, 1, 'final', 0)
VERSION = (1, 4, 2, 'final', 0)
__version__ = get_version(VERSION)

View File

@ -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)))

View File

@ -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:

View File

@ -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."

View File

@ -37,6 +37,7 @@ class PyTest(TestCommand):
errno = pytest.main(self.pytest_args)
sys.exit(errno)
tests_require = [
'pytest>=2.7.2',
'pytest-benchmark',
@ -81,10 +82,10 @@ setup(
packages=find_packages(exclude=['tests']),
install_requires=[
'six>=1.10.0',
'graphql-core>=1.1',
'graphql-relay>=0.4.5',
'promise>=2.0',
'six>=1.10.0,<2',
'graphql-core>=1.1,<2',
'graphql-relay>=0.4.5,<1',
'promise>=2.0,<2.1',
],
tests_require=tests_require,
extras_require={