From 894adb1e431028f88e84b40d7bc9d37ffa880e0d Mon Sep 17 00:00:00 2001 From: Rohitt Vashishtha Date: Tue, 30 May 2017 11:40:19 +0530 Subject: [PATCH] bots: Move contrib_bots to api/bots*. This will make it convenient to include these bots in Zulip API releases on pypi. Fix #5009. --- {contrib_bots => bots}/__init__.py | 0 {contrib_bots/bots => bots/commute}/__init__.py | 0 .../bots => bots}/commute/commute.config | 0 {contrib_bots/bots => bots}/commute/commute.py | 2 +- {contrib_bots/bots => bots}/commute/readme.md | 2 +- .../bots/commute => bots/converter}/__init__.py | 0 .../converter/assets/multiple-converts.png | Bin .../bots => bots}/converter/converter.config | 0 .../bots => bots}/converter/converter.py | 0 {contrib_bots/bots => bots}/converter/readme.md | 0 .../bots => bots}/converter/test_converter.py | 1 + {contrib_bots/bots => bots}/converter/utils.py | 0 .../bots/converter => bots/define}/__init__.py | 0 .../bots => bots}/define/assets/correct_word.png | Bin .../bots => bots}/define/assets/wrong_word.png | Bin {contrib_bots/bots => bots}/define/define.py | 0 {contrib_bots/bots => bots}/define/readme.md | 0 {contrib_bots/bots => bots}/define/test_define.py | 1 + .../bots/define => bots/encrypt}/__init__.py | 0 .../encrypt/assets/EncryptBot-terminal.png | Bin .../encrypt/assets/EncryptBot-test.png | Bin .../encrypt/assets/EncryptBot-test2.png | Bin .../encrypt/assets/EncryptBot-test3.png | Bin {contrib_bots/bots => bots}/encrypt/encrypt.py | 0 {contrib_bots/bots => bots}/encrypt/readme.md | 0 .../bots => bots}/encrypt/test_encrypt.py | 1 + .../bots/encrypt => bots/followup}/__init__.py | 0 {contrib_bots/bots => bots}/followup/followup.py | 0 .../bots/followup => bots/foursquare}/__init__.py | 0 .../bots => bots}/foursquare/foursquare.config | 0 .../bots => bots}/foursquare/foursquare.py | 4 ++-- {contrib_bots/bots => bots}/foursquare/readme.md | 0 .../bots/foursquare => bots/giphy}/__init__.py | 0 {contrib_bots/bots => bots}/giphy/giphy.py | 0 .../giphy => bots/git_hub_comment}/__init__.py | 0 .../git_hub_comment/git_hub_comment.py | 0 .../bots => bots}/git_hub_comment/readme.md | 4 ++-- .../git_hub_comment => bots/github}/__init__.py | 0 {contrib_bots/bots => bots}/github/github.py | 0 .../github => bots/github_issues}/__init__.py | 0 .../bots => bots}/github_issues/github_issues.py | 0 .../googlesearch}/__init__.py | 0 .../bots => bots}/googlesearch/googlesearch.py | 0 .../bots => bots}/googlesearch/readme.md | 0 .../googlesearch => bots/helloworld}/__init__.py | 0 .../bots => bots}/helloworld/helloworld.py | 0 {contrib_bots/bots => bots}/helloworld/readme.md | 0 .../bots => bots}/helloworld/test_helloworld.py | 1 + .../bots/helloworld => bots/help}/__init__.py | 0 {contrib_bots/bots => bots}/help/help.py | 0 {contrib_bots/bots => bots}/help/test_help.py | 1 + .../bots/help => bots/howdoi}/__init__.py | 0 .../howdoi/assets/answer_howdoi_all.png | Bin .../howdoi/assets/answer_howdowe.png | Bin .../howdoi/assets/question_howdoi_all.png | Bin .../howdoi/assets/question_howdowe.png | Bin {contrib_bots/bots => bots}/howdoi/howdoi.py | 0 {contrib_bots/bots => bots}/howdoi/readme.md | 0 .../bots/howdoi => bots/incrementor}/__init__.py | 0 .../bots => bots}/incrementor/incrementor.py | 0 {contrib_bots/bots => bots}/incrementor/readme.md | 0 .../bots/incrementor => bots/john}/__init__.py | 0 .../bots => bots}/john/assets/assist.png | Bin .../bots => bots}/john/assets/greetings.png | Bin {contrib_bots/bots => bots}/john/assets/joke.png | Bin .../bots => bots}/john/assets/var/jokes.json | 0 {contrib_bots/bots => bots}/john/john.py | 14 +++++++------- {contrib_bots/bots => bots}/john/readme.md | 0 {contrib_bots/bots => bots}/readme.md | 4 ++-- .../bots/john => bots/thesaurus}/__init__.py | 0 .../bots => bots}/thesaurus/test_thesaurus.py | 1 + .../bots => bots}/thesaurus/thesaurus.py | 2 +- .../bots/thesaurus => bots/tictactoe}/__init__.py | 0 {contrib_bots/bots => bots}/tictactoe/readme.md | 0 .../bots => bots}/tictactoe/tictactoe.py | 0 .../tictactoe => bots/virtual_fs}/__init__.py | 0 {contrib_bots/bots => bots}/virtual_fs/readme.md | 0 .../bots => bots}/virtual_fs/test_virtual_fs.py | 1 + .../bots => bots}/virtual_fs/virtual_fs.py | 0 .../bots => bots}/weather/.weather_config | 0 .../bots => bots}/weather/assets/screen1.png | Bin .../bots => bots}/weather/assets/screen2.png | Bin {contrib_bots/bots => bots}/weather/readme.md | 0 {contrib_bots/bots => bots}/weather/weather.py | 0 .../virtual_fs => bots/wikipedia}/__init__.py | 0 .../bots => bots}/wikipedia/test_wikipedia.py | 1 + .../bots => bots}/wikipedia/wikipedia.py | 0 .../bots/wikipedia => bots/xkcd}/__init__.py | 0 .../bots => bots}/xkcd/assets/xkcd-help.png | Bin .../bots => bots}/xkcd/assets/xkcd-latest.png | Bin .../bots => bots}/xkcd/assets/xkcd-random.png | Bin .../xkcd/assets/xkcd-specific-id.png | Bin .../xkcd/assets/xkcd-wrong-command.png | Bin .../bots => bots}/xkcd/assets/xkcd-wrong-id.png | Bin {contrib_bots/bots => bots}/xkcd/readme.md | 0 {contrib_bots/bots => bots}/xkcd/test_xkcd.py | 1 + {contrib_bots/bots => bots}/xkcd/xkcd.py | 0 {contrib_bots/bots/xkcd => bots/yoda}/__init__.py | 0 .../bots => bots}/yoda/assets/yoda-speak-api.png | Bin {contrib_bots/bots => bots}/yoda/readme.md | 4 ++-- {contrib_bots/bots => bots}/yoda/yoda.config | 0 {contrib_bots/bots => bots}/yoda/yoda.py | 0 .../bots => bots}/youtube/assets/screen.png | Bin {contrib_bots/bots => bots}/youtube/readme.md | 0 {contrib_bots/bots => bots}/youtube/youtube.py | 0 {contrib_bots/bots/yoda => bots_api}/__init__.py | 0 {contrib_bots => bots_api}/bot_lib.py | 4 ++-- {contrib_bots => bots_api}/bots_test_lib.py | 7 +++---- {contrib_bots => bots_api}/run.py | 4 ++-- {contrib_bots => bots_api}/test-bots | 3 ++- 110 files changed, 36 insertions(+), 27 deletions(-) rename {contrib_bots => bots}/__init__.py (100%) rename {contrib_bots/bots => bots/commute}/__init__.py (100%) rename {contrib_bots/bots => bots}/commute/commute.config (100%) rename {contrib_bots/bots => bots}/commute/commute.py (99%) rename {contrib_bots/bots => bots}/commute/readme.md (98%) rename {contrib_bots/bots/commute => bots/converter}/__init__.py (100%) rename {contrib_bots/bots => bots}/converter/assets/multiple-converts.png (100%) rename {contrib_bots/bots => bots}/converter/converter.config (100%) rename {contrib_bots/bots => bots}/converter/converter.py (100%) rename {contrib_bots/bots => bots}/converter/readme.md (100%) rename {contrib_bots/bots => bots}/converter/test_converter.py (94%) rename {contrib_bots/bots => bots}/converter/utils.py (100%) rename {contrib_bots/bots/converter => bots/define}/__init__.py (100%) rename {contrib_bots/bots => bots}/define/assets/correct_word.png (100%) rename {contrib_bots/bots => bots}/define/assets/wrong_word.png (100%) rename {contrib_bots/bots => bots}/define/define.py (100%) rename {contrib_bots/bots => bots}/define/readme.md (100%) rename {contrib_bots/bots => bots}/define/test_define.py (94%) rename {contrib_bots/bots/define => bots/encrypt}/__init__.py (100%) rename {contrib_bots/bots => bots}/encrypt/assets/EncryptBot-terminal.png (100%) rename {contrib_bots/bots => bots}/encrypt/assets/EncryptBot-test.png (100%) rename {contrib_bots/bots => bots}/encrypt/assets/EncryptBot-test2.png (100%) rename {contrib_bots/bots => bots}/encrypt/assets/EncryptBot-test3.png (100%) rename {contrib_bots/bots => bots}/encrypt/encrypt.py (100%) rename {contrib_bots/bots => bots}/encrypt/readme.md (100%) rename {contrib_bots/bots => bots}/encrypt/test_encrypt.py (93%) rename {contrib_bots/bots/encrypt => bots/followup}/__init__.py (100%) rename {contrib_bots/bots => bots}/followup/followup.py (100%) rename {contrib_bots/bots/followup => bots/foursquare}/__init__.py (100%) rename {contrib_bots/bots => bots}/foursquare/foursquare.config (100%) rename {contrib_bots/bots => bots}/foursquare/foursquare.py (96%) rename {contrib_bots/bots => bots}/foursquare/readme.md (100%) rename {contrib_bots/bots/foursquare => bots/giphy}/__init__.py (100%) rename {contrib_bots/bots => bots}/giphy/giphy.py (100%) rename {contrib_bots/bots/giphy => bots/git_hub_comment}/__init__.py (100%) rename {contrib_bots/bots => bots}/git_hub_comment/git_hub_comment.py (100%) rename {contrib_bots/bots => bots}/git_hub_comment/readme.md (94%) rename {contrib_bots/bots/git_hub_comment => bots/github}/__init__.py (100%) rename {contrib_bots/bots => bots}/github/github.py (100%) rename {contrib_bots/bots/github => bots/github_issues}/__init__.py (100%) rename {contrib_bots/bots => bots}/github_issues/github_issues.py (100%) rename {contrib_bots/bots/github_issues => bots/googlesearch}/__init__.py (100%) rename {contrib_bots/bots => bots}/googlesearch/googlesearch.py (100%) rename {contrib_bots/bots => bots}/googlesearch/readme.md (100%) rename {contrib_bots/bots/googlesearch => bots/helloworld}/__init__.py (100%) rename {contrib_bots/bots => bots}/helloworld/helloworld.py (100%) rename {contrib_bots/bots => bots}/helloworld/readme.md (100%) rename {contrib_bots/bots => bots}/helloworld/test_helloworld.py (91%) rename {contrib_bots/bots/helloworld => bots/help}/__init__.py (100%) rename {contrib_bots/bots => bots}/help/help.py (100%) rename {contrib_bots/bots => bots}/help/test_help.py (91%) rename {contrib_bots/bots/help => bots/howdoi}/__init__.py (100%) rename {contrib_bots/bots => bots}/howdoi/assets/answer_howdoi_all.png (100%) rename {contrib_bots/bots => bots}/howdoi/assets/answer_howdowe.png (100%) rename {contrib_bots/bots => bots}/howdoi/assets/question_howdoi_all.png (100%) rename {contrib_bots/bots => bots}/howdoi/assets/question_howdowe.png (100%) rename {contrib_bots/bots => bots}/howdoi/howdoi.py (100%) rename {contrib_bots/bots => bots}/howdoi/readme.md (100%) rename {contrib_bots/bots/howdoi => bots/incrementor}/__init__.py (100%) rename {contrib_bots/bots => bots}/incrementor/incrementor.py (100%) rename {contrib_bots/bots => bots}/incrementor/readme.md (100%) rename {contrib_bots/bots/incrementor => bots/john}/__init__.py (100%) rename {contrib_bots/bots => bots}/john/assets/assist.png (100%) rename {contrib_bots/bots => bots}/john/assets/greetings.png (100%) rename {contrib_bots/bots => bots}/john/assets/joke.png (100%) rename {contrib_bots/bots => bots}/john/assets/var/jokes.json (100%) rename {contrib_bots/bots => bots}/john/john.py (89%) rename {contrib_bots/bots => bots}/john/readme.md (100%) rename {contrib_bots/bots => bots}/readme.md (98%) rename {contrib_bots/bots/john => bots/thesaurus}/__init__.py (100%) rename {contrib_bots/bots => bots}/thesaurus/test_thesaurus.py (97%) rename {contrib_bots/bots => bots}/thesaurus/thesaurus.py (97%) rename {contrib_bots/bots/thesaurus => bots/tictactoe}/__init__.py (100%) rename {contrib_bots/bots => bots}/tictactoe/readme.md (100%) rename {contrib_bots/bots => bots}/tictactoe/tictactoe.py (100%) rename {contrib_bots/bots/tictactoe => bots/virtual_fs}/__init__.py (100%) rename {contrib_bots/bots => bots}/virtual_fs/readme.md (100%) rename {contrib_bots/bots => bots}/virtual_fs/test_virtual_fs.py (98%) rename {contrib_bots/bots => bots}/virtual_fs/virtual_fs.py (100%) rename {contrib_bots/bots => bots}/weather/.weather_config (100%) rename {contrib_bots/bots => bots}/weather/assets/screen1.png (100%) rename {contrib_bots/bots => bots}/weather/assets/screen2.png (100%) rename {contrib_bots/bots => bots}/weather/readme.md (100%) rename {contrib_bots/bots => bots}/weather/weather.py (100%) rename {contrib_bots/bots/virtual_fs => bots/wikipedia}/__init__.py (100%) rename {contrib_bots/bots => bots}/wikipedia/test_wikipedia.py (94%) rename {contrib_bots/bots => bots}/wikipedia/wikipedia.py (100%) rename {contrib_bots/bots/wikipedia => bots/xkcd}/__init__.py (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-help.png (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-latest.png (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-random.png (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-specific-id.png (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-wrong-command.png (100%) rename {contrib_bots/bots => bots}/xkcd/assets/xkcd-wrong-id.png (100%) rename {contrib_bots/bots => bots}/xkcd/readme.md (100%) rename {contrib_bots/bots => bots}/xkcd/test_xkcd.py (96%) rename {contrib_bots/bots => bots}/xkcd/xkcd.py (100%) rename {contrib_bots/bots/xkcd => bots/yoda}/__init__.py (100%) rename {contrib_bots/bots => bots}/yoda/assets/yoda-speak-api.png (100%) rename {contrib_bots/bots => bots}/yoda/readme.md (96%) rename {contrib_bots/bots => bots}/yoda/yoda.config (100%) rename {contrib_bots/bots => bots}/yoda/yoda.py (100%) rename {contrib_bots/bots => bots}/youtube/assets/screen.png (100%) rename {contrib_bots/bots => bots}/youtube/readme.md (100%) rename {contrib_bots/bots => bots}/youtube/youtube.py (100%) rename {contrib_bots/bots/yoda => bots_api}/__init__.py (100%) rename {contrib_bots => bots_api}/bot_lib.py (98%) rename {contrib_bots => bots_api}/bots_test_lib.py (92%) rename {contrib_bots => bots_api}/run.py (92%) rename {contrib_bots => bots_api}/test-bots (93%) diff --git a/contrib_bots/__init__.py b/bots/__init__.py similarity index 100% rename from contrib_bots/__init__.py rename to bots/__init__.py diff --git a/contrib_bots/bots/__init__.py b/bots/commute/__init__.py similarity index 100% rename from contrib_bots/bots/__init__.py rename to bots/commute/__init__.py diff --git a/contrib_bots/bots/commute/commute.config b/bots/commute/commute.config similarity index 100% rename from contrib_bots/bots/commute/commute.config rename to bots/commute/commute.config diff --git a/contrib_bots/bots/commute/commute.py b/bots/commute/commute.py similarity index 99% rename from contrib_bots/bots/commute/commute.py rename to bots/commute/commute.py index 8a55afa..b961ef8 100644 --- a/contrib_bots/bots/commute/commute.py +++ b/bots/commute/commute.py @@ -80,7 +80,7 @@ class CommuteHandler(object): # adds API Authentication Key to url request def get_api_key(self): # commute.config must be moved from - # ~/zulip/contrib_bots/bots/commute/commute.config into + # ~/zulip/api/bots/commute/commute.config into # ~/commute.config for program to work # see readme.md for more information with open(CONFIG_PATH) as settings: diff --git a/contrib_bots/bots/commute/readme.md b/bots/commute/readme.md similarity index 98% rename from contrib_bots/bots/commute/readme.md rename to bots/commute/readme.md index a60067c..d81ca13 100644 --- a/contrib_bots/bots/commute/readme.md +++ b/bots/commute/readme.md @@ -17,7 +17,7 @@ the user home directory and add an API key. Move ``` -~/zulip/contrib_bots/bots/commute/commute.config +~/zulip/api/bots/commute/commute.config ``` into diff --git a/contrib_bots/bots/commute/__init__.py b/bots/converter/__init__.py similarity index 100% rename from contrib_bots/bots/commute/__init__.py rename to bots/converter/__init__.py diff --git a/contrib_bots/bots/converter/assets/multiple-converts.png b/bots/converter/assets/multiple-converts.png similarity index 100% rename from contrib_bots/bots/converter/assets/multiple-converts.png rename to bots/converter/assets/multiple-converts.png diff --git a/contrib_bots/bots/converter/converter.config b/bots/converter/converter.config similarity index 100% rename from contrib_bots/bots/converter/converter.config rename to bots/converter/converter.config diff --git a/contrib_bots/bots/converter/converter.py b/bots/converter/converter.py similarity index 100% rename from contrib_bots/bots/converter/converter.py rename to bots/converter/converter.py diff --git a/contrib_bots/bots/converter/readme.md b/bots/converter/readme.md similarity index 100% rename from contrib_bots/bots/converter/readme.md rename to bots/converter/readme.md diff --git a/contrib_bots/bots/converter/test_converter.py b/bots/converter/test_converter.py similarity index 94% rename from contrib_bots/bots/converter/test_converter.py rename to bots/converter/test_converter.py index 90843d9..b379b08 100644 --- a/contrib_bots/bots/converter/test_converter.py +++ b/bots/converter/test_converter.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/converter/utils.py b/bots/converter/utils.py similarity index 100% rename from contrib_bots/bots/converter/utils.py rename to bots/converter/utils.py diff --git a/contrib_bots/bots/converter/__init__.py b/bots/define/__init__.py similarity index 100% rename from contrib_bots/bots/converter/__init__.py rename to bots/define/__init__.py diff --git a/contrib_bots/bots/define/assets/correct_word.png b/bots/define/assets/correct_word.png similarity index 100% rename from contrib_bots/bots/define/assets/correct_word.png rename to bots/define/assets/correct_word.png diff --git a/contrib_bots/bots/define/assets/wrong_word.png b/bots/define/assets/wrong_word.png similarity index 100% rename from contrib_bots/bots/define/assets/wrong_word.png rename to bots/define/assets/wrong_word.png diff --git a/contrib_bots/bots/define/define.py b/bots/define/define.py similarity index 100% rename from contrib_bots/bots/define/define.py rename to bots/define/define.py diff --git a/contrib_bots/bots/define/readme.md b/bots/define/readme.md similarity index 100% rename from contrib_bots/bots/define/readme.md rename to bots/define/readme.md diff --git a/contrib_bots/bots/define/test_define.py b/bots/define/test_define.py similarity index 94% rename from contrib_bots/bots/define/test_define.py rename to bots/define/test_define.py index e365860..1841fa9 100644 --- a/contrib_bots/bots/define/test_define.py +++ b/bots/define/test_define.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/define/__init__.py b/bots/encrypt/__init__.py similarity index 100% rename from contrib_bots/bots/define/__init__.py rename to bots/encrypt/__init__.py diff --git a/contrib_bots/bots/encrypt/assets/EncryptBot-terminal.png b/bots/encrypt/assets/EncryptBot-terminal.png similarity index 100% rename from contrib_bots/bots/encrypt/assets/EncryptBot-terminal.png rename to bots/encrypt/assets/EncryptBot-terminal.png diff --git a/contrib_bots/bots/encrypt/assets/EncryptBot-test.png b/bots/encrypt/assets/EncryptBot-test.png similarity index 100% rename from contrib_bots/bots/encrypt/assets/EncryptBot-test.png rename to bots/encrypt/assets/EncryptBot-test.png diff --git a/contrib_bots/bots/encrypt/assets/EncryptBot-test2.png b/bots/encrypt/assets/EncryptBot-test2.png similarity index 100% rename from contrib_bots/bots/encrypt/assets/EncryptBot-test2.png rename to bots/encrypt/assets/EncryptBot-test2.png diff --git a/contrib_bots/bots/encrypt/assets/EncryptBot-test3.png b/bots/encrypt/assets/EncryptBot-test3.png similarity index 100% rename from contrib_bots/bots/encrypt/assets/EncryptBot-test3.png rename to bots/encrypt/assets/EncryptBot-test3.png diff --git a/contrib_bots/bots/encrypt/encrypt.py b/bots/encrypt/encrypt.py similarity index 100% rename from contrib_bots/bots/encrypt/encrypt.py rename to bots/encrypt/encrypt.py diff --git a/contrib_bots/bots/encrypt/readme.md b/bots/encrypt/readme.md similarity index 100% rename from contrib_bots/bots/encrypt/readme.md rename to bots/encrypt/readme.md diff --git a/contrib_bots/bots/encrypt/test_encrypt.py b/bots/encrypt/test_encrypt.py similarity index 93% rename from contrib_bots/bots/encrypt/test_encrypt.py rename to bots/encrypt/test_encrypt.py index 21613ca..030f175 100644 --- a/contrib_bots/bots/encrypt/test_encrypt.py +++ b/bots/encrypt/test_encrypt.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/encrypt/__init__.py b/bots/followup/__init__.py similarity index 100% rename from contrib_bots/bots/encrypt/__init__.py rename to bots/followup/__init__.py diff --git a/contrib_bots/bots/followup/followup.py b/bots/followup/followup.py similarity index 100% rename from contrib_bots/bots/followup/followup.py rename to bots/followup/followup.py diff --git a/contrib_bots/bots/followup/__init__.py b/bots/foursquare/__init__.py similarity index 100% rename from contrib_bots/bots/followup/__init__.py rename to bots/foursquare/__init__.py diff --git a/contrib_bots/bots/foursquare/foursquare.config b/bots/foursquare/foursquare.config similarity index 100% rename from contrib_bots/bots/foursquare/foursquare.config rename to bots/foursquare/foursquare.config diff --git a/contrib_bots/bots/foursquare/foursquare.py b/bots/foursquare/foursquare.py similarity index 96% rename from contrib_bots/bots/foursquare/foursquare.py rename to bots/foursquare/foursquare.py index e71a18a..2fa11aa 100644 --- a/contrib_bots/bots/foursquare/foursquare.py +++ b/bots/foursquare/foursquare.py @@ -9,11 +9,11 @@ from six.moves import configparser as cp from six.moves import range home = expanduser('~') -CONFIG_PATH = home + '/zulip/contrib_bots/bots/foursquare/foursquare.config' +CONFIG_PATH = home + '/zulip/api/bots/foursquare/foursquare.config' def get_api_key(): # foursquare.config must have been moved from - # ~/zulip/contrib_bots/bots/foursquare/foursquare.config into + # ~/zulip/api/bots/foursquare/foursquare.config into # ~/foursquare.config for program to work # see readme.md for more information with open(CONFIG_PATH) as settings: diff --git a/contrib_bots/bots/foursquare/readme.md b/bots/foursquare/readme.md similarity index 100% rename from contrib_bots/bots/foursquare/readme.md rename to bots/foursquare/readme.md diff --git a/contrib_bots/bots/foursquare/__init__.py b/bots/giphy/__init__.py similarity index 100% rename from contrib_bots/bots/foursquare/__init__.py rename to bots/giphy/__init__.py diff --git a/contrib_bots/bots/giphy/giphy.py b/bots/giphy/giphy.py similarity index 100% rename from contrib_bots/bots/giphy/giphy.py rename to bots/giphy/giphy.py diff --git a/contrib_bots/bots/giphy/__init__.py b/bots/git_hub_comment/__init__.py similarity index 100% rename from contrib_bots/bots/giphy/__init__.py rename to bots/git_hub_comment/__init__.py diff --git a/contrib_bots/bots/git_hub_comment/git_hub_comment.py b/bots/git_hub_comment/git_hub_comment.py similarity index 100% rename from contrib_bots/bots/git_hub_comment/git_hub_comment.py rename to bots/git_hub_comment/git_hub_comment.py diff --git a/contrib_bots/bots/git_hub_comment/readme.md b/bots/git_hub_comment/readme.md similarity index 94% rename from contrib_bots/bots/git_hub_comment/readme.md rename to bots/git_hub_comment/readme.md index d852c4f..06ffc56 100644 --- a/contrib_bots/bots/git_hub_comment/readme.md +++ b/bots/git_hub_comment/readme.md @@ -26,8 +26,8 @@ github_token = (The personal access token for the GitHub bot) Here is an example of running the `git_hub_comment` bot from inside a Zulip repo: - `cd ~/zulip/contrib_bots` - `./run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod` + `cd ~/zulip/api` + `bots_api/run.py bots/git_hub_comment/git_hub_comment.py --config-file ~/.zuliprc-prod` Once the bot code starts running, you will see a message explaining how to use the bot, as well as diff --git a/contrib_bots/bots/git_hub_comment/__init__.py b/bots/github/__init__.py similarity index 100% rename from contrib_bots/bots/git_hub_comment/__init__.py rename to bots/github/__init__.py diff --git a/contrib_bots/bots/github/github.py b/bots/github/github.py similarity index 100% rename from contrib_bots/bots/github/github.py rename to bots/github/github.py diff --git a/contrib_bots/bots/github/__init__.py b/bots/github_issues/__init__.py similarity index 100% rename from contrib_bots/bots/github/__init__.py rename to bots/github_issues/__init__.py diff --git a/contrib_bots/bots/github_issues/github_issues.py b/bots/github_issues/github_issues.py similarity index 100% rename from contrib_bots/bots/github_issues/github_issues.py rename to bots/github_issues/github_issues.py diff --git a/contrib_bots/bots/github_issues/__init__.py b/bots/googlesearch/__init__.py similarity index 100% rename from contrib_bots/bots/github_issues/__init__.py rename to bots/googlesearch/__init__.py diff --git a/contrib_bots/bots/googlesearch/googlesearch.py b/bots/googlesearch/googlesearch.py similarity index 100% rename from contrib_bots/bots/googlesearch/googlesearch.py rename to bots/googlesearch/googlesearch.py diff --git a/contrib_bots/bots/googlesearch/readme.md b/bots/googlesearch/readme.md similarity index 100% rename from contrib_bots/bots/googlesearch/readme.md rename to bots/googlesearch/readme.md diff --git a/contrib_bots/bots/googlesearch/__init__.py b/bots/helloworld/__init__.py similarity index 100% rename from contrib_bots/bots/googlesearch/__init__.py rename to bots/helloworld/__init__.py diff --git a/contrib_bots/bots/helloworld/helloworld.py b/bots/helloworld/helloworld.py similarity index 100% rename from contrib_bots/bots/helloworld/helloworld.py rename to bots/helloworld/helloworld.py diff --git a/contrib_bots/bots/helloworld/readme.md b/bots/helloworld/readme.md similarity index 100% rename from contrib_bots/bots/helloworld/readme.md rename to bots/helloworld/readme.md diff --git a/contrib_bots/bots/helloworld/test_helloworld.py b/bots/helloworld/test_helloworld.py similarity index 91% rename from contrib_bots/bots/helloworld/test_helloworld.py rename to bots/helloworld/test_helloworld.py index c115ae0..256b8b8 100644 --- a/contrib_bots/bots/helloworld/test_helloworld.py +++ b/bots/helloworld/test_helloworld.py @@ -8,6 +8,7 @@ import sys from six.moves import zip our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/helloworld/__init__.py b/bots/help/__init__.py similarity index 100% rename from contrib_bots/bots/helloworld/__init__.py rename to bots/help/__init__.py diff --git a/contrib_bots/bots/help/help.py b/bots/help/help.py similarity index 100% rename from contrib_bots/bots/help/help.py rename to bots/help/help.py diff --git a/contrib_bots/bots/help/test_help.py b/bots/help/test_help.py similarity index 91% rename from contrib_bots/bots/help/test_help.py rename to bots/help/test_help.py index 8a2633c..c115722 100644 --- a/contrib_bots/bots/help/test_help.py +++ b/bots/help/test_help.py @@ -8,6 +8,7 @@ import sys from six.moves import zip our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/help/__init__.py b/bots/howdoi/__init__.py similarity index 100% rename from contrib_bots/bots/help/__init__.py rename to bots/howdoi/__init__.py diff --git a/contrib_bots/bots/howdoi/assets/answer_howdoi_all.png b/bots/howdoi/assets/answer_howdoi_all.png similarity index 100% rename from contrib_bots/bots/howdoi/assets/answer_howdoi_all.png rename to bots/howdoi/assets/answer_howdoi_all.png diff --git a/contrib_bots/bots/howdoi/assets/answer_howdowe.png b/bots/howdoi/assets/answer_howdowe.png similarity index 100% rename from contrib_bots/bots/howdoi/assets/answer_howdowe.png rename to bots/howdoi/assets/answer_howdowe.png diff --git a/contrib_bots/bots/howdoi/assets/question_howdoi_all.png b/bots/howdoi/assets/question_howdoi_all.png similarity index 100% rename from contrib_bots/bots/howdoi/assets/question_howdoi_all.png rename to bots/howdoi/assets/question_howdoi_all.png diff --git a/contrib_bots/bots/howdoi/assets/question_howdowe.png b/bots/howdoi/assets/question_howdowe.png similarity index 100% rename from contrib_bots/bots/howdoi/assets/question_howdowe.png rename to bots/howdoi/assets/question_howdowe.png diff --git a/contrib_bots/bots/howdoi/howdoi.py b/bots/howdoi/howdoi.py similarity index 100% rename from contrib_bots/bots/howdoi/howdoi.py rename to bots/howdoi/howdoi.py diff --git a/contrib_bots/bots/howdoi/readme.md b/bots/howdoi/readme.md similarity index 100% rename from contrib_bots/bots/howdoi/readme.md rename to bots/howdoi/readme.md diff --git a/contrib_bots/bots/howdoi/__init__.py b/bots/incrementor/__init__.py similarity index 100% rename from contrib_bots/bots/howdoi/__init__.py rename to bots/incrementor/__init__.py diff --git a/contrib_bots/bots/incrementor/incrementor.py b/bots/incrementor/incrementor.py similarity index 100% rename from contrib_bots/bots/incrementor/incrementor.py rename to bots/incrementor/incrementor.py diff --git a/contrib_bots/bots/incrementor/readme.md b/bots/incrementor/readme.md similarity index 100% rename from contrib_bots/bots/incrementor/readme.md rename to bots/incrementor/readme.md diff --git a/contrib_bots/bots/incrementor/__init__.py b/bots/john/__init__.py similarity index 100% rename from contrib_bots/bots/incrementor/__init__.py rename to bots/john/__init__.py diff --git a/contrib_bots/bots/john/assets/assist.png b/bots/john/assets/assist.png similarity index 100% rename from contrib_bots/bots/john/assets/assist.png rename to bots/john/assets/assist.png diff --git a/contrib_bots/bots/john/assets/greetings.png b/bots/john/assets/greetings.png similarity index 100% rename from contrib_bots/bots/john/assets/greetings.png rename to bots/john/assets/greetings.png diff --git a/contrib_bots/bots/john/assets/joke.png b/bots/john/assets/joke.png similarity index 100% rename from contrib_bots/bots/john/assets/joke.png rename to bots/john/assets/joke.png diff --git a/contrib_bots/bots/john/assets/var/jokes.json b/bots/john/assets/var/jokes.json similarity index 100% rename from contrib_bots/bots/john/assets/var/jokes.json rename to bots/john/assets/var/jokes.json diff --git a/contrib_bots/bots/john/john.py b/bots/john/john.py similarity index 89% rename from contrib_bots/bots/john/john.py rename to bots/john/john.py index 29e0319..341b859 100644 --- a/contrib_bots/bots/john/john.py +++ b/bots/john/john.py @@ -11,14 +11,14 @@ except ImportError: raise ImportError("""It looks like you are missing chatterbot. Please: pip install chatterbot""") -CONTRIB_BOTS_DIR = os.path.dirname(os.path.abspath(__file__)) -os.chdir(os.path.dirname(CONTRIB_BOTS_DIR)) -sys.path.insert(0, os.path.dirname(CONTRIB_BOTS_DIR)) +BOTS_DIR = os.path.dirname(os.path.abspath(__file__)) +os.chdir(os.path.dirname(BOTS_DIR)) +sys.path.insert(0, os.path.dirname(BOTS_DIR)) -JOKES_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/jokes.json') -DATABASE_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var/database.db') -DIRECTORY_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets') -VAR_PATH = os.path.join(CONTRIB_BOTS_DIR, 'assets/var') +JOKES_PATH = os.path.join(BOTS_DIR, 'assets/var/jokes.json') +DATABASE_PATH = os.path.join(BOTS_DIR, 'assets/var/database.db') +DIRECTORY_PATH = os.path.join(BOTS_DIR, 'assets') +VAR_PATH = os.path.join(BOTS_DIR, 'assets/var') if not os.path.exists(DIRECTORY_PATH): os.makedirs(DIRECTORY_PATH) diff --git a/contrib_bots/bots/john/readme.md b/bots/john/readme.md similarity index 100% rename from contrib_bots/bots/john/readme.md rename to bots/john/readme.md diff --git a/contrib_bots/bots/readme.md b/bots/readme.md similarity index 98% rename from contrib_bots/bots/readme.md rename to bots/readme.md index 8a4ce63..85a37e8 100644 --- a/contrib_bots/bots/readme.md +++ b/bots/readme.md @@ -29,8 +29,8 @@ to messages in any of the following settings: Here is an example of running the "follow-up" bot from inside a Zulip repo (and in your remote instance): - cd ~/zulip/contrib_bots - ./run.py bots/followup/followup.py --config-file ~/.zuliprc-prod + cd ~/zulip/api + bots_api/run.py bots/followup/followup.py --config-file ~/.zuliprc-prod Once the bot code starts running, you will see a message explaining how to use the bot, as well as diff --git a/contrib_bots/bots/john/__init__.py b/bots/thesaurus/__init__.py similarity index 100% rename from contrib_bots/bots/john/__init__.py rename to bots/thesaurus/__init__.py diff --git a/contrib_bots/bots/thesaurus/test_thesaurus.py b/bots/thesaurus/test_thesaurus.py similarity index 97% rename from contrib_bots/bots/thesaurus/test_thesaurus.py rename to bots/thesaurus/test_thesaurus.py index ba41f41..bb485a9 100644 --- a/contrib_bots/bots/thesaurus/test_thesaurus.py +++ b/bots/thesaurus/test_thesaurus.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/thesaurus/thesaurus.py b/bots/thesaurus/thesaurus.py similarity index 97% rename from contrib_bots/bots/thesaurus/thesaurus.py rename to bots/thesaurus/thesaurus.py index 8960c47..db25e03 100644 --- a/contrib_bots/bots/thesaurus/thesaurus.py +++ b/bots/thesaurus/thesaurus.py @@ -1,4 +1,4 @@ -# See zulip/contrib_bots/bots/readme.md for instructions on running this code. +# See zulip/api/bots/readme.md for instructions on running this code. from __future__ import print_function import sys import logging diff --git a/contrib_bots/bots/thesaurus/__init__.py b/bots/tictactoe/__init__.py similarity index 100% rename from contrib_bots/bots/thesaurus/__init__.py rename to bots/tictactoe/__init__.py diff --git a/contrib_bots/bots/tictactoe/readme.md b/bots/tictactoe/readme.md similarity index 100% rename from contrib_bots/bots/tictactoe/readme.md rename to bots/tictactoe/readme.md diff --git a/contrib_bots/bots/tictactoe/tictactoe.py b/bots/tictactoe/tictactoe.py similarity index 100% rename from contrib_bots/bots/tictactoe/tictactoe.py rename to bots/tictactoe/tictactoe.py diff --git a/contrib_bots/bots/tictactoe/__init__.py b/bots/virtual_fs/__init__.py similarity index 100% rename from contrib_bots/bots/tictactoe/__init__.py rename to bots/virtual_fs/__init__.py diff --git a/contrib_bots/bots/virtual_fs/readme.md b/bots/virtual_fs/readme.md similarity index 100% rename from contrib_bots/bots/virtual_fs/readme.md rename to bots/virtual_fs/readme.md diff --git a/contrib_bots/bots/virtual_fs/test_virtual_fs.py b/bots/virtual_fs/test_virtual_fs.py similarity index 98% rename from contrib_bots/bots/virtual_fs/test_virtual_fs.py rename to bots/virtual_fs/test_virtual_fs.py index 2252f17..f7b60ea 100644 --- a/contrib_bots/bots/virtual_fs/test_virtual_fs.py +++ b/bots/virtual_fs/test_virtual_fs.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/virtual_fs/virtual_fs.py b/bots/virtual_fs/virtual_fs.py similarity index 100% rename from contrib_bots/bots/virtual_fs/virtual_fs.py rename to bots/virtual_fs/virtual_fs.py diff --git a/contrib_bots/bots/weather/.weather_config b/bots/weather/.weather_config similarity index 100% rename from contrib_bots/bots/weather/.weather_config rename to bots/weather/.weather_config diff --git a/contrib_bots/bots/weather/assets/screen1.png b/bots/weather/assets/screen1.png similarity index 100% rename from contrib_bots/bots/weather/assets/screen1.png rename to bots/weather/assets/screen1.png diff --git a/contrib_bots/bots/weather/assets/screen2.png b/bots/weather/assets/screen2.png similarity index 100% rename from contrib_bots/bots/weather/assets/screen2.png rename to bots/weather/assets/screen2.png diff --git a/contrib_bots/bots/weather/readme.md b/bots/weather/readme.md similarity index 100% rename from contrib_bots/bots/weather/readme.md rename to bots/weather/readme.md diff --git a/contrib_bots/bots/weather/weather.py b/bots/weather/weather.py similarity index 100% rename from contrib_bots/bots/weather/weather.py rename to bots/weather/weather.py diff --git a/contrib_bots/bots/virtual_fs/__init__.py b/bots/wikipedia/__init__.py similarity index 100% rename from contrib_bots/bots/virtual_fs/__init__.py rename to bots/wikipedia/__init__.py diff --git a/contrib_bots/bots/wikipedia/test_wikipedia.py b/bots/wikipedia/test_wikipedia.py similarity index 94% rename from contrib_bots/bots/wikipedia/test_wikipedia.py rename to bots/wikipedia/test_wikipedia.py index 45dcbd5..5d9f50f 100644 --- a/contrib_bots/bots/wikipedia/test_wikipedia.py +++ b/bots/wikipedia/test_wikipedia.py @@ -7,6 +7,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/wikipedia/wikipedia.py b/bots/wikipedia/wikipedia.py similarity index 100% rename from contrib_bots/bots/wikipedia/wikipedia.py rename to bots/wikipedia/wikipedia.py diff --git a/contrib_bots/bots/wikipedia/__init__.py b/bots/xkcd/__init__.py similarity index 100% rename from contrib_bots/bots/wikipedia/__init__.py rename to bots/xkcd/__init__.py diff --git a/contrib_bots/bots/xkcd/assets/xkcd-help.png b/bots/xkcd/assets/xkcd-help.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-help.png rename to bots/xkcd/assets/xkcd-help.png diff --git a/contrib_bots/bots/xkcd/assets/xkcd-latest.png b/bots/xkcd/assets/xkcd-latest.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-latest.png rename to bots/xkcd/assets/xkcd-latest.png diff --git a/contrib_bots/bots/xkcd/assets/xkcd-random.png b/bots/xkcd/assets/xkcd-random.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-random.png rename to bots/xkcd/assets/xkcd-random.png diff --git a/contrib_bots/bots/xkcd/assets/xkcd-specific-id.png b/bots/xkcd/assets/xkcd-specific-id.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-specific-id.png rename to bots/xkcd/assets/xkcd-specific-id.png diff --git a/contrib_bots/bots/xkcd/assets/xkcd-wrong-command.png b/bots/xkcd/assets/xkcd-wrong-command.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-wrong-command.png rename to bots/xkcd/assets/xkcd-wrong-command.png diff --git a/contrib_bots/bots/xkcd/assets/xkcd-wrong-id.png b/bots/xkcd/assets/xkcd-wrong-id.png similarity index 100% rename from contrib_bots/bots/xkcd/assets/xkcd-wrong-id.png rename to bots/xkcd/assets/xkcd-wrong-id.png diff --git a/contrib_bots/bots/xkcd/readme.md b/bots/xkcd/readme.md similarity index 100% rename from contrib_bots/bots/xkcd/readme.md rename to bots/xkcd/readme.md diff --git a/contrib_bots/bots/xkcd/test_xkcd.py b/bots/xkcd/test_xkcd.py similarity index 96% rename from contrib_bots/bots/xkcd/test_xkcd.py rename to bots/xkcd/test_xkcd.py index fa43894..4d702b1 100644 --- a/contrib_bots/bots/xkcd/test_xkcd.py +++ b/bots/xkcd/test_xkcd.py @@ -8,6 +8,7 @@ import os import sys our_dir = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.normpath(os.path.join(our_dir))) # For dev setups, we can find the API in the repo itself. if os.path.exists(os.path.join(our_dir, '..')): sys.path.insert(0, '..') diff --git a/contrib_bots/bots/xkcd/xkcd.py b/bots/xkcd/xkcd.py similarity index 100% rename from contrib_bots/bots/xkcd/xkcd.py rename to bots/xkcd/xkcd.py diff --git a/contrib_bots/bots/xkcd/__init__.py b/bots/yoda/__init__.py similarity index 100% rename from contrib_bots/bots/xkcd/__init__.py rename to bots/yoda/__init__.py diff --git a/contrib_bots/bots/yoda/assets/yoda-speak-api.png b/bots/yoda/assets/yoda-speak-api.png similarity index 100% rename from contrib_bots/bots/yoda/assets/yoda-speak-api.png rename to bots/yoda/assets/yoda-speak-api.png diff --git a/contrib_bots/bots/yoda/readme.md b/bots/yoda/readme.md similarity index 96% rename from contrib_bots/bots/yoda/readme.md rename to bots/yoda/readme.md index bc9e16e..742b066 100644 --- a/contrib_bots/bots/yoda/readme.md +++ b/bots/yoda/readme.md @@ -44,8 +44,8 @@ If you need help while the bot is running just input `@mention-bot help`. Here is an example of running the "yoda" bot from inside a Zulip repo: - cd ~/zulip/contrib_bots - ./run.py bots/yoda/yoda.py --config-file ~/.zuliprc-prod + cd ~/zulip/api + bots_api/run.py bots/yoda/yoda.py --config-file ~/.zuliprc-prod Once the bot code starts running, you will see a message explaining how to use the bot, as well as diff --git a/contrib_bots/bots/yoda/yoda.config b/bots/yoda/yoda.config similarity index 100% rename from contrib_bots/bots/yoda/yoda.config rename to bots/yoda/yoda.config diff --git a/contrib_bots/bots/yoda/yoda.py b/bots/yoda/yoda.py similarity index 100% rename from contrib_bots/bots/yoda/yoda.py rename to bots/yoda/yoda.py diff --git a/contrib_bots/bots/youtube/assets/screen.png b/bots/youtube/assets/screen.png similarity index 100% rename from contrib_bots/bots/youtube/assets/screen.png rename to bots/youtube/assets/screen.png diff --git a/contrib_bots/bots/youtube/readme.md b/bots/youtube/readme.md similarity index 100% rename from contrib_bots/bots/youtube/readme.md rename to bots/youtube/readme.md diff --git a/contrib_bots/bots/youtube/youtube.py b/bots/youtube/youtube.py similarity index 100% rename from contrib_bots/bots/youtube/youtube.py rename to bots/youtube/youtube.py diff --git a/contrib_bots/bots/yoda/__init__.py b/bots_api/__init__.py similarity index 100% rename from contrib_bots/bots/yoda/__init__.py rename to bots_api/__init__.py diff --git a/contrib_bots/bot_lib.py b/bots_api/bot_lib.py similarity index 98% rename from contrib_bots/bot_lib.py rename to bots_api/bot_lib.py index 3079608..d9ad384 100644 --- a/contrib_bots/bot_lib.py +++ b/bots_api/bot_lib.py @@ -15,8 +15,8 @@ from types import ModuleType our_dir = os.path.dirname(os.path.abspath(__file__)) # For dev setups, we can find the API in the repo itself. -if os.path.exists(os.path.join(our_dir, '../api/zulip')): - sys.path.insert(0, '../api') +if os.path.exists(os.path.join(our_dir, '../zulip')): + sys.path.insert(0, os.path.join(our_dir, '../')) from zulip import Client diff --git a/contrib_bots/bots_test_lib.py b/bots_api/bots_test_lib.py similarity index 92% rename from contrib_bots/bots_test_lib.py rename to bots_api/bots_test_lib.py index 04f82fc..8555a6b 100644 --- a/contrib_bots/bots_test_lib.py +++ b/bots_api/bots_test_lib.py @@ -12,7 +12,7 @@ from mock import MagicMock, patch from run import get_lib_module from bot_lib import StateHandler -from contrib_bots import bot_lib +from bots_api import bot_lib from six.moves import zip from unittest import TestCase @@ -27,8 +27,7 @@ class BotTestCase(TestCase): def assert_bot_output(self, request, response): # type: (Dict[str, Any], str) -> None - bot_module = os.path.join(current_dir, "bots", - self.bot_name, self.bot_name + ".py") + bot_module = os.path.normpath(os.path.join(current_dir, "../bots", self.bot_name, self.bot_name + ".py")) self.bot_test(messages=[request], bot_module=bot_module, bot_response=[response]) @@ -52,7 +51,7 @@ class BotTestCase(TestCase): # function. # type: (List[Dict[str, Any]], Any, List[str]) -> None # Mocking BotHandlerApi - with patch('contrib_bots.bot_lib.BotHandlerApi') as MockClass: + with patch('bots_api.bot_lib.BotHandlerApi') as MockClass: instance = MockClass.return_value for (message, response) in zip(messages, bot_response): diff --git a/contrib_bots/run.py b/bots_api/run.py similarity index 92% rename from contrib_bots/run.py rename to bots_api/run.py index 3aea942..73d8438 100755 --- a/contrib_bots/run.py +++ b/bots_api/run.py @@ -17,8 +17,8 @@ from bot_lib import run_message_handler_for_bot def get_lib_module(bots_fn): # type: (str) -> ModuleType bots_fn = os.path.realpath(bots_fn) - if not os.path.dirname(bots_fn).startswith(os.path.join(our_dir, 'bots')): - print('Sorry, we will only import code from contrib_bots/bots.') + if not os.path.dirname(bots_fn).startswith(os.path.normpath(os.path.join(our_dir, "../bots"))): + print('Sorry, we will only import code from api/bots.') sys.exit(1) if not bots_fn.endswith('.py'): diff --git a/contrib_bots/test-bots b/bots_api/test-bots similarity index 93% rename from contrib_bots/test-bots rename to bots_api/test-bots index c137bf1..9d5d17c 100755 --- a/contrib_bots/test-bots +++ b/bots_api/test-bots @@ -26,9 +26,10 @@ if __name__ == '__main__': bots_dir = os.path.dirname(os.path.abspath(__file__)) root_dir = dir_join(bots_dir, '..') - bots_test_dir = dir_join(bots_dir, 'bots') + bots_test_dir = dir_join(bots_dir, '../bots') sys.path.insert(0, root_dir) + sys.path.insert(0, bots_test_dir) # mypy doesn't recognize the TestLoader attribute, even though the code # is executable