Hashar has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/330919 )
Change subject: Fix up all flake8 errors
......................................................................
Fix up all flake8 errors
Mostly lines being too long, and whitespace issues.
Change-Id: Ib51c5009bcaa37aaa058670e706fda4803805d47
---
M backend/__main__.py
M backend/celery/__init__.py
M backend/celery/api.py
M backend/server/__init__.py
M backend/server/flask_mwoauth/__init__.py
M tox.ini
6 files changed, 32 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/labs/tools/crosswatch
refs/changes/19/330919/1
diff --git a/backend/__main__.py b/backend/__main__.py
index 61699b2..8c6a252 100644
--- a/backend/__main__.py
+++ b/backend/__main__.py
@@ -15,4 +15,4 @@
sys.exit(1)
else:
port = int(sys.argv[1])
- run(port)
\ No newline at end of file
+ run(port)
diff --git a/backend/celery/__init__.py b/backend/celery/__init__.py
index 8935427..f4f64d3 100644
--- a/backend/celery/__init__.py
+++ b/backend/celery/__init__.py
@@ -41,8 +41,8 @@
},
CELERY_SEND_TASK_ERROR_EMAILS=True,
- SERVER_EMAIL = config.email,
- ADMINS = [(config.toolname, config.email)],
- EMAIL_HOST = config.mail_server,
- EMAIL_PORT = 25
+ SERVER_EMAIL=config.email,
+ ADMINS=[(config.toolname, config.email)],
+ EMAIL_HOST=config.mail_server,
+ EMAIL_PORT=25
)
diff --git a/backend/celery/api.py b/backend/celery/api.py
index 54a13c4..1a87b51 100644
--- a/backend/celery/api.py
+++ b/backend/celery/api.py
@@ -23,7 +23,8 @@
access_token=None, redis_channel=None):
self.api_url = host + path
- self.user_agent = "crosswatch (https://tools.wmflabs.org/crosswatch;"
+\
+ self.user_agent = \
+ "crosswatch (https://tools.wmflabs.org/crosswatch;" +\
"[email protected]) python-requests/" +\
requests.__version__
self.headers = {'User-Agent': self.user_agent}
@@ -68,7 +69,8 @@
logger.error(response['error'])
if self.redis_channel:
- if response['error']['code'] ==
'mwoauth-invalid-authorization':
+ if response['error']['code'] == \
+ 'mwoauth-invalid-authorization':
self.publish({'msgtype': 'loginerror',
'errorinfo': response['error']['info']})
else:
@@ -279,4 +281,4 @@
:param revision: a revision dict containing ‘revid’ and ‘pageid’
"""
session = RevertsSession(self.api_url, user_agent=self.user_agent)
- return reverts.check_rev(session, revision)
\ No newline at end of file
+ return reverts.check_rev(session, revision)
diff --git a/backend/server/__init__.py b/backend/server/__init__.py
index 7264fe6..d376296 100644
--- a/backend/server/__init__.py
+++ b/backend/server/__init__.py
@@ -25,8 +25,8 @@
from .. import config
toolname = config.toolname
-from .oauth_handler import app as oauth_wsgi
-from ..celery import app as celery_app
+from .oauth_handler import app as oauth_wsgi # noqa
+from ..celery import app as celery_app # noqa
# Create the tornadoredis.Client instance
# and use it for redis channel subscriptions
@@ -52,8 +52,9 @@
celery_app.send_task('backend.celery.tasks.initial_task',
kwargs=data, expires=60)
elif data['action'] == 'notifications_mark_read':
-
celery_app.send_task('backend.celery.tasks.notifications_mark_read',
- kwargs=data, expires=60)
+ celery_app.send_task(
+ 'backend.celery.tasks.notifications_mark_read',
+ kwargs=data, expires=60)
elif data['action'] == 'diff':
celery_app.send_task('backend.celery.tasks.get_diff', kwargs=data)
elif data['action'] == 'watch':
@@ -77,7 +78,9 @@
# Config sockjs
sockjs_settings = {
- "sockjs_url":
"https://tools-static.wmflabs.org/cdnjs/ajax/libs/sockjs-client/1.0.0/sockjs.min.js"
+ "sockjs_url":
+ "https://tools-static.wmflabs.org/cdnjs" +
+ "/ajax/libs/sockjs-client/1.0.0/sockjs.min.js"
}
sockjsrouter = SockJSRouter(SockConnection, '/' + toolname + '/sockjs',
user_settings=sockjs_settings)
diff --git a/backend/server/flask_mwoauth/__init__.py
b/backend/server/flask_mwoauth/__init__.py
index 1f02b17..5769b11 100644
--- a/backend/server/flask_mwoauth/__init__.py
+++ b/backend/server/flask_mwoauth/__init__.py
@@ -9,7 +9,7 @@
#
from future.moves.urllib.parse import urlencode
-from flask import request, session, Blueprint, make_response, redirect,
render_template
+from flask import request, session, Blueprint, make_response, redirect,
render_template # noqa
from flask_oauthlib.client import OAuth, OAuthException
import json
@@ -36,11 +36,15 @@
self.mwoauth = self.oauth.remote_app(
'mw.org',
base_url=base_url + "/index.php",
- request_token_url=base_url + "/index.php?" +
- urlencode(request_url_params),
+ request_token_url=(
+ base_url + "/index.php?" +
+ urlencode(request_url_params)
+ ),
request_token_params=None,
- access_token_url=base_url + "/index.php?" +
- urlencode(access_token_params),
+ access_token_url=(
+ base_url + "/index.php?" +
+ urlencode(access_token_params)
+ ),
authorize_url=clean_url + '/Special:OAuth/authorize',
consumer_key=consumer_key,
consumer_secret=consumer_secret,
@@ -95,7 +99,8 @@
@self.bp.route('/logout')
def logout():
- resp = make_response(render_template('logout.html',
toolname=self.toolname))
+ resp = make_response(
+ render_template('logout.html', toolname=self.toolname))
session['mwo_token'] = None
resp.set_cookie(self.toolname + '.auth', '',
path='/' + self.toolname + '/', expires=0)
diff --git a/tox.ini b/tox.ini
index b134b7f..40faa85 100644
--- a/tox.ini
+++ b/tox.ini
@@ -10,3 +10,6 @@
deps = flake8
commands = flake8 {posargs}
+
+[flake8]
+exclude = .tox,dist,build,*.egg-info
--
To view, visit https://gerrit.wikimedia.org/r/330919
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib51c5009bcaa37aaa058670e706fda4803805d47
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/crosswatch
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits