]> git.cworth.org Git - turbot/commitdiff
Fix some code style issues identified by flake8
authorCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 13:12:55 +0000 (06:12 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 13:12:55 +0000 (06:12 -0700)
Some of the things fixed include TAB based indentation of a
documentation string, some unneeded semicolons, a missing exception
name, and an excessively long line.

.flake8
turbot.py

diff --git a/.flake8 b/.flake8
index f474faebcee64c5fb3ef9215c13a65a8651149b3..532d8e51be0d1bd064b5fbcc6dd9c436a50b72d8 100644 (file)
--- a/.flake8
+++ b/.flake8
@@ -1,2 +1,2 @@
 [flake8]
-ignore = E305
+ignore = E251, E305, E302
index 4a6aaffa8b614abe9a659eaece897ffbe133dcb2..4224d429ca0ee996d8424f476cb3d3b8d248b7d6 100755 (executable)
--- a/turbot.py
+++ b/turbot.py
@@ -42,7 +42,7 @@ def rot():
     This implements the /rot command of our Slack bot. The format of this
     command is as follows:
 
-       /rot [count|*] String to be rotated
+        /rot [count|*] String to be rotated
 
     The optional count indicates an amount to rotate each character in the
     string. If the count is '*' or is not present, then the string will
@@ -54,8 +54,8 @@ def rot():
     in a direct message that it is not a member of. Otherwise, if the slash
     command was issued in a channel, the bot will reply in that channel."""
 
-    data = request.get_data();
-    headers = request.headers;
+    data = request.get_data()
+    headers = request.headers
     response_url = request.form.get('response_url')
     channel_name = request.form.get('channel_name')
     channel = request.form.get('channel_id')
@@ -68,7 +68,7 @@ def rot():
     if (match):
         try:
             count = int(match.group(1))
-        except:
+        except ValueError:
             count = None
         text = match.group(2)
     else:
@@ -82,7 +82,8 @@ def rot():
     if count:
         reply += rot_string(text, count)
     else:
-        reply += "\n".join(["{:02d} ".format(count) + rot_string(text, count) for count in range(1,26)])
+        reply += "\n".join(["{:02d} ".format(count) + rot_string(text, count)
+                            for count in range(1, 26)])
 
     reply += "```"