diff --git a/tools/custom_check.py b/tools/custom_check.py index 706ceb3..d4342e6 100644 --- a/tools/custom_check.py +++ b/tools/custom_check.py @@ -166,7 +166,11 @@ def build_custom_checkers(by_lang): # and comments which should be rewritten to avoid use of "python2", "python3", etc. {'pattern': 'python[23]', 'exclude': set(['tools/provision']), + 'include_only': set(['zulip/', 'tools/', 'zulip_botserver/']), 'description': 'Explicit python invocations should not include a version'}, + {'pattern': '#!/usr/bin/env python$', + 'include_only': set(['zulip_bots/']), + 'description': 'Python shebangs must be python3'}, {'pattern': '(^|\s)open\s*\(', 'description': 'open() should not be used in Zulip\'s bots. Use functions' ' provided by the bots framework to access the filesystem.', diff --git a/zulip_bots/generate_manifest.py b/zulip_bots/generate_manifest.py index d5a8bce..cc13eb0 100755 --- a/zulip_bots/generate_manifest.py +++ b/zulip_bots/generate_manifest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import os diff --git a/zulip_bots/setup.py b/zulip_bots/setup.py index 03eb9a1..fc07041 100755 --- a/zulip_bots/setup.py +++ b/zulip_bots/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function diff --git a/zulip_bots/zulip_bots/bots/chess/test_chess.py b/zulip_bots/zulip_bots/bots/chess/test_chess.py index 77d1e4b..840e4f0 100644 --- a/zulip_bots/zulip_bots/bots/chess/test_chess.py +++ b/zulip_bots/zulip_bots/bots/chess/test_chess.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase class TestChessBot(StubBotTestCase): diff --git a/zulip_bots/zulip_bots/bots/converter/test_converter.py b/zulip_bots/zulip_bots/bots/converter/test_converter.py index 65741af..afdbc15 100755 --- a/zulip_bots/zulip_bots/bots/converter/test_converter.py +++ b/zulip_bots/zulip_bots/bots/converter/test_converter.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase class TestConverterBot(StubBotTestCase): diff --git a/zulip_bots/zulip_bots/bots/define/test_define.py b/zulip_bots/zulip_bots/bots/define/test_define.py index 3822fd0..5b08826 100755 --- a/zulip_bots/zulip_bots/bots/define/test_define.py +++ b/zulip_bots/zulip_bots/bots/define/test_define.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase from unittest.mock import patch diff --git a/zulip_bots/zulip_bots/bots/dialogflow/test_dialogflow.py b/zulip_bots/zulip_bots/bots/dialogflow/test_dialogflow.py index f7ddc4b..41970e1 100644 --- a/zulip_bots/zulip_bots/bots/dialogflow/test_dialogflow.py +++ b/zulip_bots/zulip_bots/bots/dialogflow/test_dialogflow.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase, read_bot_fixture_data from contextlib import contextmanager diff --git a/zulip_bots/zulip_bots/bots/encrypt/test_encrypt.py b/zulip_bots/zulip_bots/bots/encrypt/test_encrypt.py index adb6807..7453dcf 100755 --- a/zulip_bots/zulip_bots/bots/encrypt/test_encrypt.py +++ b/zulip_bots/zulip_bots/bots/encrypt/test_encrypt.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase class TestEncryptBot(StubBotTestCase): diff --git a/zulip_bots/zulip_bots/bots/followup/test_followup.py b/zulip_bots/zulip_bots/bots/followup/test_followup.py index 2019605..564d872 100755 --- a/zulip_bots/zulip_bots/bots/followup/test_followup.py +++ b/zulip_bots/zulip_bots/bots/followup/test_followup.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from __future__ import absolute_import from __future__ import print_function diff --git a/zulip_bots/zulip_bots/bots/giphy/test_giphy.py b/zulip_bots/zulip_bots/bots/giphy/test_giphy.py index cc54c76..2abc20a 100755 --- a/zulip_bots/zulip_bots/bots/giphy/test_giphy.py +++ b/zulip_bots/zulip_bots/bots/giphy/test_giphy.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from unittest.mock import patch from requests.exceptions import HTTPError, ConnectionError diff --git a/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py b/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py index 5adfbb9..cf56ad4 100755 --- a/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py +++ b/zulip_bots/zulip_bots/bots/github_detail/test_github_detail.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import ( StubBotHandler, StubBotTestCase, diff --git a/zulip_bots/zulip_bots/bots/google_search/test_google_search.py b/zulip_bots/zulip_bots/bots/google_search/test_google_search.py index da3caec..eb531fc 100644 --- a/zulip_bots/zulip_bots/bots/google_search/test_google_search.py +++ b/zulip_bots/zulip_bots/bots/google_search/test_google_search.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase from unittest.mock import patch diff --git a/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py b/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py index 8396dc9..78a563f 100755 --- a/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py +++ b/zulip_bots/zulip_bots/bots/helloworld/test_helloworld.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase class TestHelpBot(StubBotTestCase): diff --git a/zulip_bots/zulip_bots/bots/help/test_help.py b/zulip_bots/zulip_bots/bots/help/test_help.py index 32d2fc7..be2adab 100755 --- a/zulip_bots/zulip_bots/bots/help/test_help.py +++ b/zulip_bots/zulip_bots/bots/help/test_help.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase from typing import Any diff --git a/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py b/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py index 6d34480..a8186fd 100644 --- a/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py +++ b/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python import mock from zulip_bots.test_lib import ( diff --git a/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py index b98f270..aba3765 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py +++ b/zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python from zulip_bots.test_lib import StubBotTestCase class TestTictactoeBot(StubBotTestCase): diff --git a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py index 0824125..e0b2b44 100755 --- a/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py +++ b/zulip_bots/zulip_bots/bots/wikipedia/test_wikipedia.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from zulip_bots.test_lib import StubBotTestCase from zulip_bots.request_test_lib import mock_request_exception diff --git a/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py b/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py index b83b8a2..eb3e3f0 100755 --- a/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py +++ b/zulip_bots/zulip_bots/bots/xkcd/test_xkcd.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - import mock from mock import MagicMock, patch from zulip_bots.test_lib import StubBotTestCase diff --git a/zulip_bots/zulip_bots/bots/youtube/test_youtube.py b/zulip_bots/zulip_bots/bots/youtube/test_youtube.py index 0ddf232..fea4aaf 100644 --- a/zulip_bots/zulip_bots/bots/youtube/test_youtube.py +++ b/zulip_bots/zulip_bots/bots/youtube/test_youtube.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from __future__ import absolute_import from unittest.mock import patch diff --git a/zulip_bots/zulip_bots/provision.py b/zulip_bots/zulip_bots/provision.py index a995490..2471e16 100755 --- a/zulip_bots/zulip_bots/provision.py +++ b/zulip_bots/zulip_bots/provision.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import absolute_import diff --git a/zulip_bots/zulip_bots/run.py b/zulip_bots/zulip_bots/run.py index a623e11..befb1cd 100755 --- a/zulip_bots/zulip_bots/run.py +++ b/zulip_bots/zulip_bots/run.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function from __future__ import absolute_import diff --git a/zulip_bots/zulip_bots/terminal.py b/zulip_bots/zulip_bots/terminal.py index 5043097..2759bf1 100644 --- a/zulip_bots/zulip_bots/terminal.py +++ b/zulip_bots/zulip_bots/terminal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys import argparse diff --git a/zulip_bots/zulip_bots/test_run.py b/zulip_bots/zulip_bots/test_run.py index 7c90201..55b0f4e 100644 --- a/zulip_bots/zulip_bots/test_run.py +++ b/zulip_bots/zulip_bots/test_run.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import absolute_import import importlib