Skip to content

Commit 58ccddc

Browse files
vkmrishadshahidhk
authored andcommitted
pep8 fixes for python files (hasura#875)
1 parent eb926f5 commit 58ccddc

File tree

17 files changed

+224
-183
lines changed

17 files changed

+224
-183
lines changed

community/boilerplates/auth-webhooks/python-flask/auth-webhook.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from flask import Flask
22
from flask import request, jsonify, abort
3+
34
app = Flask(__name__)
45

56

@@ -24,6 +25,7 @@ def get_details_for_token(token):
2425
def hello():
2526
return 'webhook is running'
2627

28+
2729
@app.route('/auth-webhook')
2830
def auth_webhook():
2931
# get the auth token from Authorization header

community/boilerplates/serverless-triggers/aws-lambda/python/echo/echo.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22

3+
34
def lambda_handler(event, context):
45
try:
56
body = json.loads(event['body'])

community/boilerplates/serverless-triggers/aws-lambda/python/mutation/mutation.py

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
}
2525
"""
2626

27+
2728
def lambda_handler(event, context):
2829
try:
2930
body = json.loads(event['body'])

community/boilerplates/serverless-triggers/google-cloud-functions/python/echo/main.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from flask import jsonify
22

3+
34
def function(request):
45
request_json = request.get_json()
56
op = request_json['event']['op']

docs/_ext/lexer_jsx.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pygments.lexers.javascript import JavascriptLexer
55
from pygments.token import Name, Operator, Punctuation, String, Text
66

7-
87
# Use same tokens as `JavascriptLexer`, but with tags and attributes support
98
TOKENS = JavascriptLexer.tokens
109
TOKENS.update({
@@ -26,7 +25,7 @@
2625
('{', Punctuation, 'expression'),
2726
('".*?"', String, '#pop'),
2827
("'.*?'", String, '#pop'),
29-
default ('#pop')
28+
default('#pop')
3029
],
3130
'expression': [
3231
('{', Punctuation, '#push'),

docs/_ext/local_toctree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
the maximum depth of the tree; set it to -1 to allow unlimited depth
1212
"""
1313

14-
def init_local_toctree(app):
1514

15+
def init_local_toctree(app):
1616
def _get_local_toctree(docname, **kwds):
1717
doctree = app.env.get_doctree(docname)
1818
if 'maxdepth' not in kwds:
1919
kwds['maxdepth'] = 0
2020
toctrees = []
2121
for toctreenode in doctree.traverse(addnodes.toctree):
2222
toctree = app.env.resolve_toctree(
23-
docname, app.builder, toctreenode, **kwds)
23+
docname, app.builder, toctreenode, **kwds)
2424
toctrees.append(toctree)
2525
if not toctrees:
2626
return None

docs/algolia_index/algolia_index.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def output_indexed_data():
3232

3333
print('\nTOTAL INDEXED: ' + str(count))
3434

35+
3536
def process_data(json_data):
3637
processed_data = []
3738

@@ -44,7 +45,8 @@ def process_data(json_data):
4445
else:
4546
obj = json.loads(json.dumps(json_obj))
4647

47-
split_content = [obj['content'][i:i + CONTENT_MAX_LENGTH] for i in range(0, len(obj['content']), CONTENT_MAX_LENGTH)]
48+
split_content = [obj['content'][i:i + CONTENT_MAX_LENGTH] for i in
49+
range(0, len(obj['content']), CONTENT_MAX_LENGTH)]
4850

4951
for content_piece in split_content:
5052
obj = json.loads(json.dumps(json_obj))

docs/conf.py

+16-16
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
import os
2121
import sys
2222
from os.path import abspath, dirname, join
23+
2324
sys.setrecursionlimit(2000)
2425

2526
# Monkey patching StandaloneHTMLBuilder as to not include unnecessary scripts
2627

2728
from sphinx.builders.html import StandaloneHTMLBuilder
29+
2830
# from sphinx.util.osutil import relative_uri
2931
StandaloneHTMLBuilder.script_files = ["_static/vendor.js"]
3032
# StandaloneHTMLBuilder.imgpath = relative_uri("v0.13", '_images')
@@ -138,7 +140,7 @@
138140
# The full version, including alpha/beta/rc tags.
139141
release = 'x.y'
140142

141-
#epilog rst lines for frequently reference links in docs
143+
# epilog rst lines for frequently reference links in docs
142144
rst_epilog = """
143145
"""
144146

@@ -185,7 +187,6 @@
185187
# The name of the Pygments (syntax highlighting) style to use.
186188
pygments_style = 'sphinx'
187189

188-
189190
# A list of ignored prefixes for module index sorting.
190191
# modindex_common_prefix = []
191192

@@ -195,7 +196,6 @@
195196
# If true, `todo` and `todoList` produce output, else they produce nothing.
196197
todo_include_todos = True
197198

198-
199199
# -- Options for HTML output ----------------------------------------------
200200
# import sphinx_rtd_theme
201201
# html_theme = "sphinx_rtd_theme"
@@ -205,7 +205,7 @@
205205
# The theme to use for HTML and HTML Help pages. See the documentation for
206206
# a list of builtin themes.
207207
#
208-
#html_theme = 'alabaster'
208+
# html_theme = 'alabaster'
209209

210210
# Theme options are theme-specific and customize the look and feel of a theme
211211
# further. For a list of options available for each theme, see the
@@ -325,21 +325,21 @@
325325
# -- Options for LaTeX output ---------------------------------------------
326326

327327
latex_elements = {
328-
# The paper size ('letterpaper' or 'a4paper').
329-
#
330-
# 'papersize': 'letterpaper',
328+
# The paper size ('letterpaper' or 'a4paper').
329+
#
330+
# 'papersize': 'letterpaper',
331331

332-
# The font size ('10pt', '11pt' or '12pt').
333-
#
334-
# 'pointsize': '10pt',
332+
# The font size ('10pt', '11pt' or '12pt').
333+
#
334+
# 'pointsize': '10pt',
335335

336-
# Additional stuff for the LaTeX preamble.
337-
#
338-
# 'preamble': '',
336+
# Additional stuff for the LaTeX preamble.
337+
#
338+
# 'preamble': '',
339339

340-
# Latex figure (float) alignment
341-
#
342-
# 'figure_align': 'htbp',
340+
# Latex figure (float) alignment
341+
#
342+
# 'figure_align': 'htbp',
343343
}
344344

345345
# Grouping the document tree into LaTeX files. List of tuples

server/tests-py/conftest.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33
from context import HGECtx, HGECtxError
44

5+
56
def pytest_addoption(parser):
67
parser.addoption(
78
"--hge-url", metavar="HGE_URL", help="url for graphql-engine", required=True
@@ -23,9 +24,10 @@ def pytest_addoption(parser):
2324
"--hge-jwt-key-file", metavar="HGE_JWT_KEY_FILE", help="File containting the private key used to encode jwt tokens using RS512 algorithm", required=False
2425
)
2526

27+
2628
@pytest.fixture(scope='session')
2729
def hge_ctx(request):
28-
print ("create hge_ctx")
30+
print("create hge_ctx")
2931
hge_url = request.config.getoption('--hge-url')
3032
pg_url = request.config.getoption('--pg-url')
3133
hge_key = request.config.getoption('--hge-key')

server/tests-py/context.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
from sqlalchemy import create_engine
1818
from sqlalchemy.schema import MetaData
1919

20+
2021
class HGECtxError(Exception):
2122
pass
2223

24+
2325
class WebhookHandler(http.server.BaseHTTPRequestHandler):
2426
def do_GET(self):
2527
self.send_response(HTTPStatus.OK)
@@ -52,6 +54,7 @@ def server_bind(self):
5254
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
5355
self.socket.bind(self.server_address)
5456

57+
5558
class HGECtx:
5659
def __init__(self, hge_url, pg_url, hge_key, hge_webhook, hge_jwt_key_file, webhook_insecure):
5760
server_address = ('0.0.0.0', 5592)
@@ -117,8 +120,7 @@ def get_ws_event(self, timeout):
117120
def reflect_tables(self):
118121
self.meta.reflect(bind=self.engine)
119122

120-
121-
def anyq(self, u, q, h):
123+
def anyq(self, u, q, h):
122124
resp = self.http.post(
123125
self.hge_url + u,
124126
json=q,

0 commit comments

Comments
 (0)