Skip to content

Commit 319605b

Browse files
authored
Merge branch 'master' into sdr/subclass_mutations
2 parents 181e75c + 43aec72 commit 319605b

File tree

110 files changed

+2636
-2464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2636
-2464
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,23 @@ repos:
22
- repo: git://github.com/pre-commit/pre-commit-hooks
33
rev: v1.3.0
44
hooks:
5-
- id: autopep8-wrapper
6-
args:
7-
- -i
8-
- --ignore=E128,E309,E501
9-
exclude: ^docs/.*$
105
- id: check-json
116
- id: check-yaml
127
- id: debug-statements
138
- id: end-of-file-fixer
149
exclude: ^docs/.*$
1510
- id: trailing-whitespace
11+
exclude: README.md
1612
- id: pretty-format-json
1713
args:
1814
- --autofix
1915
- id: flake8
2016
- repo: https://github.com/asottile/pyupgrade
21-
rev: v1.2.0
17+
rev: v1.4.0
2218
hooks:
2319
- id: pyupgrade
24-
- repo: https://github.com/asottile/seed-isort-config
25-
rev: v1.0.0
26-
hooks:
27-
- id: seed-isort-config
28-
- repo: https://github.com/pre-commit/mirrors-isort
29-
rev: v4.3.4
20+
- repo: https://github.com/ambv/black
21+
rev: 18.6b4
3022
hooks:
31-
- id: isort
23+
- id: black
24+
language_version: python3.6

.travis.yml

Lines changed: 22 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,28 @@
11
language: python
2-
sudo: false
3-
python:
4-
- 2.7
5-
- 3.5
6-
- 3.6
7-
# - "pypy-5.3.1"
8-
before_install:
9-
- |
10-
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
11-
export PYENV_ROOT="$HOME/.pyenv"
12-
if [ -f "$PYENV_ROOT/bin/pyenv" ]; then
13-
cd "$PYENV_ROOT" && git pull
14-
else
15-
rm -rf "$PYENV_ROOT" && git clone --depth 1 https://github.com/yyuu/pyenv.git "$PYENV_ROOT"
16-
fi
17-
export PYPY_VERSION="4.0.1"
18-
"$PYENV_ROOT/bin/pyenv" install "pypy-$PYPY_VERSION"
19-
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
20-
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
21-
fi
22-
install:
23-
- |
24-
if [ "$TEST_TYPE" = build ]; then
25-
pip install -e .[test]
26-
python setup.py develop
27-
elif [ "$TEST_TYPE" = lint ]; then
28-
pip install flake8
29-
elif [ "$TEST_TYPE" = mypy ]; then
30-
pip install mypy
31-
fi
32-
script:
33-
- |
34-
if [ "$TEST_TYPE" = lint ]; then
35-
echo "Checking Python code lint."
36-
flake8 graphene
37-
exit
38-
elif [ "$TEST_TYPE" = mypy ]; then
39-
echo "Checking Python types."
40-
mypy graphene
41-
exit
42-
elif [ "$TEST_TYPE" = build ]; then
43-
py.test --cov=graphene graphene examples
44-
fi
45-
after_success:
46-
- |
47-
if [ "$TEST_TYPE" = build ]; then
48-
coveralls
49-
fi
50-
env:
51-
matrix:
52-
- TEST_TYPE=build
53-
global:
54-
secure: SQC0eCWCWw8bZxbLE8vQn+UjJOp3Z1m779s9SMK3lCLwJxro/VCLBZ7hj4xsrq1MtcFO2U2Kqf068symw4Hr/0amYI3HFTCFiwXAC3PAKXeURca03eNO2heku+FtnQcOjBanExTsIBQRLDXMOaUkf3MIztpLJ4LHqMfUupKmw9YSB0v40jDbSN8khBnndFykmOnVVHznFp8USoN5F0CiPpnfEvHnJkaX76lNf7Kc9XNShBTTtJsnsHMhuYQeInt0vg9HSjoIYC38Tv2hmMj1myNdzyrHF+LgRjI6ceGi50ApAnGepXC/DNRhXROfECKez+LON/ZSqBGdJhUILqC8A4WmWmIjNcwitVFp3JGBqO7LULS0BI96EtSLe8rD1rkkdTbjivajkbykM1Q0Tnmg1adzGwLxRUbTq9tJQlTTkHBCuXIkpKb1mAtb/TY7A6BqfnPi2xTc/++qEawUG7ePhscdTj0IBrUfZsUNUYZqD8E8XbSWKIuS3SHE+cZ+s/kdAsm4q+FFAlpZKOYGxIkwvgyfu4/Plfol4b7X6iAP9J3r1Kv0DgBVFst5CXEwzZs19/g0CgokQbCXf1N+xeNnUELl6/fImaR3RKP22EaABoil4z8vzl4EqxqVoH1nfhE+WlpryXsuSaF/1R+WklR7aQ1FwoCk8V8HxM2zrj4tI8k=
552
matrix:
56-
fast_finish: true
573
include:
58-
- python: '2.7'
59-
env: TEST_TYPE=lint
60-
- python: '3.6'
61-
env: TEST_TYPE=mypy
4+
- env: TOXENV=py27
5+
python: 2.7
6+
- env: TOXENV=py34
7+
python: 3.4
8+
- env: TOXENV=py35
9+
python: 3.5
10+
- env: TOXENV=py36
11+
python: 3.6
12+
- env: TOXENV=pypy
13+
python: pypy-5.7.1
14+
- env: TOXENV=pre-commit
15+
python: 3.6
16+
- env: TOXENV=mypy
17+
python: 3.6
18+
install:
19+
- pip install coveralls tox
20+
script: tox
21+
after_success: coveralls
22+
cache:
23+
directories:
24+
- $HOME/.cache/pip
25+
- $HOME/.cache/pre-commit
6226
deploy:
6327
provider: pypi
6428
user: syrusakbary

docs/conf.py

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import sphinx_graphene_theme
44

5-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
5+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
66

77
# -*- coding: utf-8 -*-
88
#
@@ -36,46 +36,44 @@
3636
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3737
# ones.
3838
extensions = [
39-
'sphinx.ext.autodoc',
40-
'sphinx.ext.intersphinx',
41-
'sphinx.ext.todo',
42-
'sphinx.ext.coverage',
43-
'sphinx.ext.viewcode',
39+
"sphinx.ext.autodoc",
40+
"sphinx.ext.intersphinx",
41+
"sphinx.ext.todo",
42+
"sphinx.ext.coverage",
43+
"sphinx.ext.viewcode",
4444
]
4545
if not on_rtd:
46-
extensions += [
47-
'sphinx.ext.githubpages',
48-
]
46+
extensions += ["sphinx.ext.githubpages"]
4947

5048
# Add any paths that contain templates here, relative to this directory.
51-
templates_path = ['_templates']
49+
templates_path = ["_templates"]
5250

5351
# The suffix(es) of source filenames.
5452
# You can specify multiple suffix as a list of string:
5553
#
5654
# source_suffix = ['.rst', '.md']
57-
source_suffix = '.rst'
55+
source_suffix = ".rst"
5856

5957
# The encoding of source files.
6058
#
6159
# source_encoding = 'utf-8-sig'
6260

6361
# The master toctree document.
64-
master_doc = 'index'
62+
master_doc = "index"
6563

6664
# General information about the project.
67-
project = u'Graphene'
68-
copyright = u'Graphene 2016'
69-
author = u'Syrus Akbary'
65+
project = u"Graphene"
66+
copyright = u"Graphene 2016"
67+
author = u"Syrus Akbary"
7068

7169
# The version info for the project you're documenting, acts as replacement for
7270
# |version| and |release|, also used in various other places throughout the
7371
# built documents.
7472
#
7573
# The short X.Y version.
76-
version = u'1.0'
74+
version = u"1.0"
7775
# The full version, including alpha/beta/rc tags.
78-
release = u'1.0'
76+
release = u"1.0"
7977

8078
# The language for content autogenerated by Sphinx. Refer to documentation
8179
# for a list of supported languages.
@@ -96,7 +94,7 @@
9694
# List of patterns, relative to source directory, that match files and
9795
# directories to ignore when looking for source files.
9896
# This patterns also effect to html_static_path and html_extra_path
99-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
97+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
10098

10199
# The reST default role (used for this markup: `text`) to use for all
102100
# documents.
@@ -118,7 +116,7 @@
118116
# show_authors = False
119117

120118
# The name of the Pygments (syntax highlighting) style to use.
121-
pygments_style = 'sphinx'
119+
pygments_style = "sphinx"
122120

123121
# A list of ignored prefixes for module index sorting.
124122
# modindex_common_prefix = []
@@ -175,7 +173,7 @@
175173
# Add any paths that contain custom static files (such as style sheets) here,
176174
# relative to this directory. They are copied after the builtin static files,
177175
# so a file named "default.css" will overwrite the builtin "default.css".
178-
html_static_path = ['_static']
176+
html_static_path = ["_static"]
179177

180178
# Add any extra paths that contain custom files (such as robots.txt or
181179
# .htaccess) here, relative to this directory. These files are copied
@@ -255,34 +253,30 @@
255253
# html_search_scorer = 'scorer.js'
256254

257255
# Output file base name for HTML help builder.
258-
htmlhelp_basename = 'Graphenedoc'
256+
htmlhelp_basename = "Graphenedoc"
259257

260258
# -- Options for LaTeX output ---------------------------------------------
261259

262260
latex_elements = {
263-
# The paper size ('letterpaper' or 'a4paper').
264-
#
265-
# 'papersize': 'letterpaper',
266-
267-
# The font size ('10pt', '11pt' or '12pt').
268-
#
269-
# 'pointsize': '10pt',
270-
271-
# Additional stuff for the LaTeX preamble.
272-
#
273-
# 'preamble': '',
274-
275-
# Latex figure (float) alignment
276-
#
277-
# 'figure_align': 'htbp',
261+
# The paper size ('letterpaper' or 'a4paper').
262+
#
263+
# 'papersize': 'letterpaper',
264+
# The font size ('10pt', '11pt' or '12pt').
265+
#
266+
# 'pointsize': '10pt',
267+
# Additional stuff for the LaTeX preamble.
268+
#
269+
# 'preamble': '',
270+
# Latex figure (float) alignment
271+
#
272+
# 'figure_align': 'htbp',
278273
}
279274

280275
# Grouping the document tree into LaTeX files. List of tuples
281276
# (source start file, target name, title,
282277
# author, documentclass [howto, manual, or own class]).
283278
latex_documents = [
284-
(master_doc, 'Graphene.tex', u'Graphene Documentation',
285-
u'Syrus Akbary', 'manual'),
279+
(master_doc, "Graphene.tex", u"Graphene Documentation", u"Syrus Akbary", "manual")
286280
]
287281

288282
# The name of an image file (relative to this directory) to place at the top of
@@ -322,10 +316,7 @@
322316

323317
# One entry per manual page. List of tuples
324318
# (source start file, name, description, authors, manual section).
325-
man_pages = [
326-
(master_doc, 'graphene', u'Graphene Documentation',
327-
[author], 1)
328-
]
319+
man_pages = [(master_doc, "graphene", u"Graphene Documentation", [author], 1)]
329320

330321
# If true, show URL addresses after external links.
331322
#
@@ -338,9 +329,15 @@
338329
# (source start file, target name, title, author,
339330
# dir menu entry, description, category)
340331
texinfo_documents = [
341-
(master_doc, 'Graphene', u'Graphene Documentation',
342-
author, 'Graphene', 'One line description of project.',
343-
'Miscellaneous'),
332+
(
333+
master_doc,
334+
"Graphene",
335+
u"Graphene Documentation",
336+
author,
337+
"Graphene",
338+
"One line description of project.",
339+
"Miscellaneous",
340+
)
344341
]
345342

346343
# Documents to append as an appendix to all manuals.
@@ -414,7 +411,7 @@
414411
# epub_post_files = []
415412

416413
# A list of files that should not be packed into the epub file.
417-
epub_exclude_files = ['search.html']
414+
epub_exclude_files = ["search.html"]
418415

419416
# The depth of the table of contents in toc.ncx.
420417
#
@@ -447,9 +444,15 @@
447444

448445
# Example configuration for intersphinx: refer to the Python standard library.
449446
intersphinx_mapping = {
450-
'https://docs.python.org/': None,
451-
'python': ('https://docs.python.org/', None),
452-
'graphene_django': ('http://docs.graphene-python.org/projects/django/en/latest/', None),
453-
'graphene_sqlalchemy': ('http://docs.graphene-python.org/projects/sqlalchemy/en/latest/', None),
454-
'graphene_gae': ('http://docs.graphene-python.org/projects/gae/en/latest/', None),
447+
"https://docs.python.org/": None,
448+
"python": ("https://docs.python.org/", None),
449+
"graphene_django": (
450+
"http://docs.graphene-python.org/projects/django/en/latest/",
451+
None,
452+
),
453+
"graphene_sqlalchemy": (
454+
"http://docs.graphene-python.org/projects/sqlalchemy/en/latest/",
455+
None,
456+
),
457+
"graphene_gae": ("http://docs.graphene-python.org/projects/gae/en/latest/", None),
455458
}

examples/complex_example.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def resolve_address(self, info, geo):
2222

2323

2424
class CreateAddress(graphene.Mutation):
25-
2625
class Arguments:
2726
geo = GeoInput(required=True)
2827

@@ -37,42 +36,34 @@ class Mutation(graphene.ObjectType):
3736

3837

3938
schema = graphene.Schema(query=Query, mutation=Mutation)
40-
query = '''
39+
query = """
4140
query something{
4241
address(geo: {lat:32.2, lng:12}) {
4342
latlng
4443
}
4544
}
46-
'''
47-
mutation = '''
45+
"""
46+
mutation = """
4847
mutation addAddress{
4948
createAddress(geo: {lat:32.2, lng:12}) {
5049
latlng
5150
}
5251
}
53-
'''
52+
"""
5453

5554

5655
def test_query():
5756
result = schema.execute(query)
5857
assert not result.errors
59-
assert result.data == {
60-
'address': {
61-
'latlng': "(32.2,12.0)",
62-
}
63-
}
58+
assert result.data == {"address": {"latlng": "(32.2,12.0)"}}
6459

6560

6661
def test_mutation():
6762
result = schema.execute(mutation)
6863
assert not result.errors
69-
assert result.data == {
70-
'createAddress': {
71-
'latlng': "(32.2,12.0)",
72-
}
73-
}
64+
assert result.data == {"createAddress": {"latlng": "(32.2,12.0)"}}
7465

7566

76-
if __name__ == '__main__':
67+
if __name__ == "__main__":
7768
result = schema.execute(query)
78-
print(result.data['address']['latlng'])
69+
print(result.data["address"]["latlng"])

0 commit comments

Comments
 (0)