From: Carl Worth Date: Tue, 13 Oct 2020 22:28:58 +0000 (-0700) Subject: Fix several problems pointed out by flake8 X-Git-Url: https://git.cworth.org/git?p=turbot;a=commitdiff_plain;h=5e217ceb8c26334fdac4b410c2b403d6de0ed311 Fix several problems pointed out by flake8 I really should integrate flake8 more decisively into my workflow somehow. Note: I'm ignoring W503 here since it's contradictory with W504, (breaking a "line too long" problem at an operator will cause one of W503 or W504 to fire and there's no way I can see to shut them both up). --- diff --git a/.flake8 b/.flake8 index 532d8e5..677e0cd 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,2 @@ [flake8] -ignore = E251, E305, E302 +ignore = E251, E305, E302, W503 diff --git a/turbot/slack.py b/turbot/slack.py index 34fe44d..8dc5ccc 100644 --- a/turbot/slack.py +++ b/turbot/slack.py @@ -1,6 +1,5 @@ from flask import current_app from slack import WebClient -from slack.errors import SlackApiError from slack.signature import SignatureVerifier import os import requests @@ -59,4 +58,3 @@ def slack_send_message(channel, text): """Send a Slack message to a specified channel.""" slack_client.chat_postMessage(channel=channel, text=text) - diff --git a/turbot/views.py b/turbot/views.py index c7c8ac7..ae897cc 100644 --- a/turbot/views.py +++ b/turbot/views.py @@ -39,7 +39,8 @@ def home(user_id, body): return { "type": "home", "blocks": [ - section(text("This is (or soon will be) a list of available puzzle hunts)")), + section(text("This is (or soon will be) a list of " + + "available puzzle hunts)")), actions(button("New hunt", "new_hunt")) ] } diff --git a/turbot_flask/turbot.py b/turbot_flask/turbot.py index bcbc91e..735c427 100644 --- a/turbot_flask/turbot.py +++ b/turbot_flask/turbot.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from flask import Flask, request +from flask import Flask, request, make_response from slackeventsapi import SlackEventAdapter from turbot.slack import slack_is_valid_request, slack_send_reply import os diff --git a/turbot_lambda/turbot_lambda.py b/turbot_lambda/turbot_lambda.py index b8d55ad..fc047e3 100644 --- a/turbot_lambda/turbot_lambda.py +++ b/turbot_lambda/turbot_lambda.py @@ -38,7 +38,7 @@ def slack_is_valid_request(slack_signature, timestamp, body): This implements the Slack signature verification using the slack signing secret (obtained via an SSM parameter in code above).""" - content = "v0:{}:{}".format(timestamp,body).encode('utf-8') + content = "v0:{}:{}".format(timestamp, body).encode('utf-8') signature = 'v0=' + hmac.new(slack_signing_secret, content,