Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Run black formatter via pre-commit on all files
  • Loading branch information
Daniel Gallagher committed Jul 6, 2018
1 parent 71bcbb8 commit 086f9dd
Show file tree
Hide file tree
Showing 109 changed files with 2,513 additions and 2,504 deletions.
5 changes: 0 additions & 5 deletions .pre-commit-config.yaml
Expand Up @@ -2,11 +2,6 @@ repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: autopep8-wrapper
args:
- -i
- --ignore=E128,E309,E501
exclude: ^docs/.*$
- id: check-json
- id: check-yaml
- id: debug-statements
Expand Down
105 changes: 54 additions & 51 deletions docs/conf.py
Expand Up @@ -2,7 +2,7 @@

import sphinx_graphene_theme

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

# -*- coding: utf-8 -*-
#
Expand Down Expand Up @@ -36,46 +36,44 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
]
if not on_rtd:
extensions += [
'sphinx.ext.githubpages',
]
extensions += ["sphinx.ext.githubpages"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'Graphene'
copyright = u'Graphene 2016'
author = u'Syrus Akbary'
project = u"Graphene"
copyright = u"Graphene 2016"
author = u"Syrus Akbary"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'1.0'
version = u"1.0"
# The full version, including alpha/beta/rc tags.
release = u'1.0'
release = u"1.0"

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

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

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

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

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

# Output file base name for HTML help builder.
htmlhelp_basename = 'Graphenedoc'
htmlhelp_basename = "Graphenedoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Graphene.tex', u'Graphene Documentation',
u'Syrus Akbary', 'manual'),
(master_doc, "Graphene.tex", u"Graphene Documentation", u"Syrus Akbary", "manual")
]

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

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'graphene', u'Graphene Documentation',
[author], 1)
]
man_pages = [(master_doc, "graphene", u"Graphene Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -338,9 +329,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Graphene', u'Graphene Documentation',
author, 'Graphene', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"Graphene",
u"Graphene Documentation",
author,
"Graphene",
"One line description of project.",
"Miscellaneous",
)
]

# Documents to append as an appendix to all manuals.
Expand Down Expand Up @@ -414,7 +411,7 @@
# epub_post_files = []

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
epub_exclude_files = ["search.html"]

# The depth of the table of contents in toc.ncx.
#
Expand Down Expand Up @@ -447,9 +444,15 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'https://docs.python.org/': None,
'python': ('https://docs.python.org/', None),
'graphene_django': ('http://docs.graphene-python.org/projects/django/en/latest/', None),
'graphene_sqlalchemy': ('http://docs.graphene-python.org/projects/sqlalchemy/en/latest/', None),
'graphene_gae': ('http://docs.graphene-python.org/projects/gae/en/latest/', None),
"https://docs.python.org/": None,
"python": ("https://docs.python.org/", None),
"graphene_django": (
"http://docs.graphene-python.org/projects/django/en/latest/",
None,
),
"graphene_sqlalchemy": (
"http://docs.graphene-python.org/projects/sqlalchemy/en/latest/",
None,
),
"graphene_gae": ("http://docs.graphene-python.org/projects/gae/en/latest/", None),
}
24 changes: 8 additions & 16 deletions examples/complex_example.py
Expand Up @@ -37,42 +37,34 @@ class Mutation(graphene.ObjectType):


schema = graphene.Schema(query=Query, mutation=Mutation)
query = '''
query = """
query something{
address(geo: {lat:32.2, lng:12}) {
latlng
}
}
'''
mutation = '''
"""
mutation = """
mutation addAddress{
createAddress(geo: {lat:32.2, lng:12}) {
latlng
}
}
'''
"""


def test_query():
result = schema.execute(query)
assert not result.errors
assert result.data == {
'address': {
'latlng': "(32.2,12.0)",
}
}
assert result.data == {"address": {"latlng": "(32.2,12.0)"}}


def test_mutation():
result = schema.execute(mutation)
assert not result.errors
assert result.data == {
'createAddress': {
'latlng': "(32.2,12.0)",
}
}
assert result.data == {"createAddress": {"latlng": "(32.2,12.0)"}}


if __name__ == '__main__':
if __name__ == "__main__":
result = schema.execute(query)
print(result.data['address']['latlng'])
print(result.data["address"]["latlng"])
21 changes: 8 additions & 13 deletions examples/context_example.py
Expand Up @@ -10,31 +10,26 @@ class Query(graphene.ObjectType):
me = graphene.Field(User)

def resolve_me(self, info):
return info.context['user']
return info.context["user"]


schema = graphene.Schema(query=Query)
query = '''
query = """
query something{
me {
id
name
}
}
'''
"""


def test_query():
result = schema.execute(query, context_value={'user': User(id='1', name='Syrus')})
result = schema.execute(query, context_value={"user": User(id="1", name="Syrus")})
assert not result.errors
assert result.data == {
'me': {
'id': '1',
'name': 'Syrus',
}
}
assert result.data == {"me": {"id": "1", "name": "Syrus"}}


if __name__ == '__main__':
result = schema.execute(query, context_value={'user': User(id='X', name='Console')})
print(result.data['me'])
if __name__ == "__main__":
result = schema.execute(query, context_value={"user": User(id="X", name="Console")})
print(result.data["me"])
18 changes: 6 additions & 12 deletions examples/simple_example.py
Expand Up @@ -12,33 +12,27 @@ class Query(graphene.ObjectType):
patron = graphene.Field(Patron)

def resolve_patron(self, info):
return Patron(id=1, name='Syrus', age=27)
return Patron(id=1, name="Syrus", age=27)


schema = graphene.Schema(query=Query)
query = '''
query = """
query something{
patron {
id
name
age
}
}
'''
"""


def test_query():
result = schema.execute(query)
assert not result.errors
assert result.data == {
'patron': {
'id': '1',
'name': 'Syrus',
'age': 27,
}
}
assert result.data == {"patron": {"id": "1", "name": "Syrus", "age": 27}}


if __name__ == '__main__':
if __name__ == "__main__":
result = schema.execute(query)
print(result.data['patron'])
print(result.data["patron"])

0 comments on commit 086f9dd

Please sign in to comment.