]> git.cworth.org Git - turbot/commitdiff
Fix several problems pointed out by flake8
authorCarl Worth <cworth@cworth.org>
Tue, 13 Oct 2020 22:28:58 +0000 (15:28 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 13 Oct 2020 22:28:58 +0000 (15:28 -0700)
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).

.flake8
turbot/slack.py
turbot/views.py
turbot_flask/turbot.py
turbot_lambda/turbot_lambda.py

diff --git a/.flake8 b/.flake8
index 532d8e51be0d1bd064b5fbcc6dd9c436a50b72d8..677e0cd9f90cd3ee6aff5be4f999b7b29ba8b810 100644 (file)
--- a/.flake8
+++ b/.flake8
@@ -1,2 +1,2 @@
 [flake8]
 [flake8]
-ignore = E251, E305, E302
+ignore = E251, E305, E302, W503
index 34fe44d0a6cf543ff89a02763747d358b5cd9047..8dc5ccc14ce8dec9e09bd13721589cacb14e5d73 100644 (file)
@@ -1,6 +1,5 @@
 from flask import current_app
 from slack import WebClient
 from flask import current_app
 from slack import WebClient
-from slack.errors import SlackApiError
 from slack.signature import SignatureVerifier
 import os
 import requests
 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)
     """Send a Slack message to a specified channel."""
 
     slack_client.chat_postMessage(channel=channel, text=text)
-
index c7c8ac71271ad1323e6fb48e5caf19e0c79c9bbd..ae897cce8f0740fd88d4f4c215061ab8796edf1e 100644 (file)
@@ -39,7 +39,8 @@ def home(user_id, body):
     return {
         "type": "home",
         "blocks": [
     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"))
         ]
     }
             actions(button("New hunt", "new_hunt"))
         ]
     }
index bcbc91e899ef7f7adc0d8b215988647fd1d9c78c..735c4273f17770113081a675623fb2ec713f4699 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 
 #!/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
 from slackeventsapi import SlackEventAdapter
 from turbot.slack import slack_is_valid_request, slack_send_reply
 import os
index b8d55ad4fcfadb3c60118d7407bed7582fcb6518..fc047e3408d894d87cb2c3a2812d9400296d620b 100644 (file)
@@ -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)."""
 
     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,
 
     signature = 'v0=' + hmac.new(slack_signing_secret,
                                  content,