isort: Reformat using isort.
This commit is contained in:
parent
37e2596124
commit
5580c68ae5
162 changed files with 539 additions and 444 deletions
|
@ -70,7 +70,7 @@ setuptools_info = dict(
|
|||
)
|
||||
|
||||
try:
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import find_packages, setup
|
||||
package_info.update(setuptools_info)
|
||||
package_info['packages'] = find_packages()
|
||||
package_info['package_data'] = package_data
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
from typing import Any, List, Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class BaremetricsHandler:
|
||||
def initialize(self, bot_handler: BotHandler) -> None:
|
||||
self.config_info = bot_handler.get_config_info('baremetrics')
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from unittest.mock import patch
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.test_lib import StubBotHandler
|
||||
|
||||
from zulip_bots.bots.baremetrics.baremetrics import BaremetricsHandler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
|
||||
|
||||
|
||||
class TestBaremetricsBot(BotTestCase, DefaultTests):
|
||||
bot_name = "baremetrics"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import requests
|
||||
import logging
|
||||
from typing import Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
help_message = '''
|
||||
You can add datapoints towards your beeminder goals \
|
||||
following the syntax shown below :smile:.\n \
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from unittest.mock import patch
|
||||
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
|
||||
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestBeeminderBot(BotTestCase, DefaultTests):
|
||||
bot_name = "beeminder"
|
||||
normal_config = {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import copy
|
||||
import re
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import chess
|
||||
import chess.uci
|
||||
import re
|
||||
import copy
|
||||
from typing import Any, Optional, Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
START_REGEX = re.compile('start with other user$')
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestChessBot(BotTestCase, DefaultTests):
|
||||
bot_name = "chessbot"
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from zulip_bots.game_handler import GameAdapter
|
||||
from zulip_bots.bots.connect_four.controller import ConnectFourModel
|
||||
from typing import Any
|
||||
|
||||
from zulip_bots.bots.connect_four.controller import ConnectFourModel
|
||||
from zulip_bots.game_handler import GameAdapter
|
||||
|
||||
|
||||
class ConnectFourMessageHandler:
|
||||
tokens = [':blue_circle:', ':red_circle:']
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from copy import deepcopy
|
||||
from functools import reduce
|
||||
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from typing import Dict, List
|
||||
|
||||
from zulip_bots.bots.connect_four.connect_four import ConnectFourModel
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
from typing import Dict, List
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestConnectFourBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
import copy
|
||||
from math import log10, floor
|
||||
from math import floor, log10
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from zulip_bots.bots.converter import utils
|
||||
|
||||
from typing import Any, Dict, List
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
def is_float(value: Any) -> bool:
|
||||
try:
|
||||
float(value)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from zulip_bots.bots.converter import utils
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from zulip_bots.bots.converter import utils
|
||||
|
||||
class TestConverterBot(BotTestCase, DefaultTests):
|
||||
bot_name = "converter"
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
import logging
|
||||
import requests
|
||||
import html2text
|
||||
import string
|
||||
|
||||
from typing import Dict
|
||||
|
||||
import html2text
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class DefineHandler:
|
||||
'''
|
||||
This plugin define a word that the user inputs. It
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestDefineBot(BotTestCase, DefaultTests):
|
||||
bot_name = "define"
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
import logging
|
||||
import json
|
||||
import logging
|
||||
from typing import Dict
|
||||
|
||||
import apiai
|
||||
|
||||
from typing import Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
help_message = '''DialogFlow bot
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests, read_bot_fixture_data
|
||||
|
||||
import json
|
||||
from contextlib import contextmanager
|
||||
|
||||
from typing import ByteString, Iterator
|
||||
from unittest.mock import patch
|
||||
|
||||
from typing import Iterator, ByteString
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, read_bot_fixture_data
|
||||
|
||||
import json
|
||||
|
||||
class MockHttplibRequest():
|
||||
def __init__(self, response: str) -> None:
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from dropbox import Dropbox
|
||||
from typing import Any, Dict, List, Tuple
|
||||
from zulip_bots.lib import BotHandler
|
||||
import re
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
from dropbox import Dropbox
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
URL = "[{name}](https://www.dropbox.com/home{path})"
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.bots.dropbox_share.test_util import (
|
||||
MockFileMetadata,
|
||||
MockHttpResponse,
|
||||
MockListFolderResult,
|
||||
MockPathLinkMetadata,
|
||||
MockSearchMatch,
|
||||
MockSearchResult,
|
||||
MockPathLinkMetadata,
|
||||
MockHttpResponse
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
def get_root_files_list(*args, **kwargs):
|
||||
return MockListFolderResult(
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from typing import List
|
||||
|
||||
|
||||
class MockFileMetadata:
|
||||
def __init__(self, name: str, path_lower: str):
|
||||
self.name = name
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from typing import Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
def encrypt(text: str) -> str:
|
||||
# This is where the actual ROT13 is applied
|
||||
# WHY IS .JOIN NOT WORKING?!
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestEncryptBot(BotTestCase, DefaultTests):
|
||||
bot_name = "encrypt"
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from typing import Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class FileUploaderHandler:
|
||||
def usage(self) -> str:
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
from pathlib import Path
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from zulip_bots.test_lib import (
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
class TestFileUploaderBot(BotTestCase, DefaultTests):
|
||||
bot_name = "file_uploader"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import logging
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
import requests
|
||||
from typing import Any, Dict, List, Tuple, Optional
|
||||
from zulip_bots.lib import BotHandler
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
USERS_LIST_URL = 'https://api.flock.co/v1/roster.listContacts'
|
||||
SEND_MESSAGE_URL = 'https://api.flock.co/v1/chat.sendMessage'
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
from unittest.mock import patch
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestFlockBot(BotTestCase, DefaultTests):
|
||||
bot_name = "flock"
|
||||
normal_config = {"token": "12345"}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
from typing import Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class FollowupHandler:
|
||||
'''
|
||||
This plugin facilitates creating follow-up tasks when
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
from zulip_bots.test_lib import (
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestFollowUpBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import requests
|
||||
import re
|
||||
from typing import Any, Dict
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class FrontHandler:
|
||||
FRONT_API = "https://api2.frontapp.com/conversations/{}"
|
||||
COMMANDS = [
|
||||
|
|
|
@ -2,6 +2,7 @@ from typing import Any, Dict, Optional
|
|||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestFrontBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'front'
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.game_handler import GameAdapter, BadMoveException
|
||||
from typing import List, Any
|
||||
from typing import Any, List
|
||||
|
||||
from zulip_bots.game_handler import BadMoveException, GameAdapter
|
||||
|
||||
|
||||
class GameHandlerBotMessageHandler:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from mock import patch
|
||||
|
||||
from typing import Any, Dict, List
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestGameHandlerBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import copy
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
from zulip_bots.game_handler import BadMoveException, GameAdapter
|
||||
|
||||
from typing import List, Any, Tuple, Dict
|
||||
from zulip_bots.game_handler import GameAdapter, BadMoveException
|
||||
|
||||
class GameOfFifteenModel:
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
from zulip_bots.bots.game_of_fifteen.game_of_fifteen import GameOfFifteenModel
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
from typing import Dict, List, Tuple
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestGameOfFifteenBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from typing import Dict, Union
|
||||
from zulip_bots.lib import BotHandler
|
||||
import requests
|
||||
import logging
|
||||
from requests.exceptions import HTTPError, ConnectionError
|
||||
from typing import Dict, Union
|
||||
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError, HTTPError
|
||||
|
||||
from zulip_bots.custom_exceptions import ConfigValidationError
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
GIPHY_TRANSLATE_API = 'http://api.giphy.com/v1/gifs/translate'
|
||||
GIPHY_RANDOM_API = 'http://api.giphy.com/v1/gifs/random'
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestGiphyBot(BotTestCase, DefaultTests):
|
||||
bot_name = "giphy"
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import re
|
||||
import logging
|
||||
import re
|
||||
from typing import Any, Dict, Tuple, Union
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Dict, Any, Tuple, Union
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class GithubHandler:
|
||||
'''
|
||||
This bot provides details on github issues and pull requests when they're
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
from zulip_bots.test_lib import (
|
||||
StubBotHandler,
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
get_bot_message_handler,
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestGithubDetailBot(BotTestCase, DefaultTests):
|
||||
bot_name = "github_detail"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
import logging
|
||||
from typing import Dict, List
|
||||
|
||||
import requests
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from typing import Dict, List
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
def google_search(keywords: str) -> List[Dict[str, str]]:
|
||||
query = {'q': keywords}
|
||||
# Gets the page
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
class TestGoogleSearchBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'google_search'
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import requests
|
||||
|
||||
|
||||
class GoogleTranslateHandler:
|
||||
'''
|
||||
This bot will translate any messages sent to it using google translate.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from requests.exceptions import ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
from typing import Any, Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class HelloWorldHandler:
|
||||
def usage(self) -> str:
|
||||
return '''
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestHelpBot(BotTestCase, DefaultTests):
|
||||
bot_name = "helloworld" # type: str
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
from typing import Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class HelpHandler:
|
||||
def usage(self) -> str:
|
||||
return '''
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestHelpBot(BotTestCase, DefaultTests):
|
||||
bot_name = "help"
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import requests
|
||||
import logging
|
||||
import re
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Any, Dict, Optional, List
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
API_BASE_URL = "https://beta.idonethis.com/api/v2"
|
||||
|
|
|
@ -2,6 +2,7 @@ from unittest.mock import patch
|
|||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestIDoneThisBot(BotTestCase, DefaultTests):
|
||||
bot_name = "idonethis" # type: str
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import re
|
||||
from typing import Any, Dict, Tuple
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
QUESTION = 'How should we handle this?'
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
from typing import Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler, use_storage
|
||||
|
||||
|
||||
class IncrementorHandler:
|
||||
META = {
|
||||
'name': 'Incrementor',
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.test_lib import (
|
||||
get_bot_message_handler,
|
||||
StubBotHandler,
|
||||
DefaultTests,
|
||||
BotTestCase,
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestIncrementorBot(BotTestCase, DefaultTests):
|
||||
bot_name = "incrementor"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import base64
|
||||
import re
|
||||
import requests
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
GET_REGEX = re.compile('get "(?P<issue_key>.+)"$')
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestJiraBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'jira'
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import re
|
||||
from typing import Any, Dict
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Any, Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class LinkShortenerHandler:
|
||||
'''A Zulip bot that will shorten URLs ("links") in a conversation using the
|
||||
goo.gl URL shortener.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from unittest.mock import patch
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.test_lib import StubBotHandler
|
||||
|
||||
from zulip_bots.bots.link_shortener.link_shortener import LinkShortenerHandler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
|
||||
|
||||
|
||||
class TestLinkShortenerBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import requests
|
||||
from typing import Any, List, Dict
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class MentionHandler:
|
||||
def initialize(self, bot_handler: BotHandler) -> None:
|
||||
self.config_info = bot_handler.get_config_info('mention')
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from zulip_bots.bots.mention.mention import MentionHandler
|
||||
from unittest.mock import patch
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.test_lib import StubBotHandler
|
||||
|
||||
from zulip_bots.bots.mention.mention import MentionHandler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
|
||||
|
||||
|
||||
class TestMentionBot(BotTestCase, DefaultTests):
|
||||
bot_name = "mention"
|
||||
|
|
|
@ -9,8 +9,8 @@ import re
|
|||
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
|
||||
from . import database
|
||||
from . import mechanics
|
||||
from . import database, mechanics
|
||||
|
||||
COMMAND_PATTERN = re.compile(
|
||||
"^(\\w*).*(\\d,\\d).*(\\d,\\d)|^(\\w+).*(\\d,\\d)")
|
||||
|
||||
|
|
|
@ -2,16 +2,14 @@
|
|||
mechanisms as well as some functions for accessing the database.
|
||||
"""
|
||||
|
||||
from collections import Counter
|
||||
from math import sqrt
|
||||
|
||||
from collections import Counter
|
||||
|
||||
from . import constants
|
||||
from . import database
|
||||
from . import game_data
|
||||
from . import interface
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
|
||||
from . import constants, database, game_data, interface
|
||||
|
||||
|
||||
def is_in_grid(vertical_pos, horizontal_pos):
|
||||
"""Checks whether the cell actually exists or not
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
from typing import List, Any
|
||||
from zulip_bots.bots.merels.libraries import (
|
||||
game,
|
||||
mechanics,
|
||||
database,
|
||||
game_data
|
||||
)
|
||||
from typing import Any, List
|
||||
|
||||
from zulip_bots.bots.merels.libraries import database, game, game_data, mechanics
|
||||
from zulip_bots.game_handler import GameAdapter, SamePlayerMove
|
||||
|
||||
|
||||
class Storage:
|
||||
data = {}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
from libraries import database
|
||||
from libraries import game_data
|
||||
from libraries import database, game_data
|
||||
|
||||
from zulip_bots.simple_lib import SimpleStorage
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class DatabaseTest(BotTestCase, DefaultTests):
|
||||
bot_name = 'merels'
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import unittest
|
||||
|
||||
from libraries import game
|
||||
from libraries import database
|
||||
from zulip_bots.simple_lib import SimpleStorage
|
||||
from libraries import database, game
|
||||
|
||||
from zulip_bots.game_handler import BadMoveException
|
||||
from zulip_bots.simple_lib import SimpleStorage
|
||||
|
||||
|
||||
class GameTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import unittest
|
||||
|
||||
from libraries import database
|
||||
from libraries import game_data
|
||||
from libraries import interface
|
||||
from libraries import mechanics
|
||||
from libraries import database, game_data, interface, mechanics
|
||||
|
||||
from zulip_bots.simple_lib import SimpleStorage
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
from libraries.constants import EMPTY_BOARD
|
||||
|
||||
from typing import List, Tuple, Any
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestMerelsBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'merels'
|
||||
|
|
|
@ -5,8 +5,7 @@ for extract.py
|
|||
from json.decoder import JSONDecodeError
|
||||
from typing import Text
|
||||
|
||||
from zulip_bots.bots.monkeytestit.lib import extract
|
||||
from zulip_bots.bots.monkeytestit.lib import report
|
||||
from zulip_bots.bots.monkeytestit.lib import extract, report
|
||||
|
||||
|
||||
def execute(message: Text, apikey: Text) -> Text:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Used to mainly compose a decorated report for the user
|
||||
"""
|
||||
|
||||
from typing import Dict, Text, List
|
||||
from typing import Dict, List, Text
|
||||
|
||||
|
||||
def compose(results: Dict) -> Text:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
from typing import Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
from zulip_bots.bots.monkeytestit.lib import parse
|
||||
from zulip_bots.lib import NoBotConfigException
|
||||
from zulip_bots.lib import BotHandler, NoBotConfigException
|
||||
|
||||
|
||||
class MonkeyTestitBot:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from importlib import import_module
|
||||
from unittest.mock import patch
|
||||
|
||||
from importlib import import_module
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestMonkeyTestitBot(BotTestCase, DefaultTests):
|
||||
bot_name = "monkeytestit"
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
import simple_salesforce
|
||||
from typing import Dict, Any, List
|
||||
from zulip_bots.lib import BotHandler
|
||||
import re
|
||||
import logging
|
||||
from zulip_bots.bots.salesforce.utils import commands, object_types, link_query, default_query
|
||||
import re
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import simple_salesforce
|
||||
|
||||
from zulip_bots.bots.salesforce.utils import commands, default_query, link_query, object_types
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
base_help_text = '''Salesforce bot
|
||||
This bot can do simple salesforce query requests
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, read_bot_fixture_data
|
||||
from simple_salesforce.exceptions import SalesforceAuthenticationFailed
|
||||
from contextlib import contextmanager
|
||||
from unittest.mock import patch
|
||||
from typing import Any, Dict, Iterator
|
||||
from unittest.mock import patch
|
||||
|
||||
from simple_salesforce.exceptions import SalesforceAuthenticationFailed
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, read_bot_fixture_data
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import requests
|
||||
import logging
|
||||
from typing import Dict, Optional
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Optional, Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
# See readme.md for instructions on running this code.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.request_test_lib import mock_request_exception
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestStackoverflowBot(BotTestCase, DefaultTests):
|
||||
bot_name = "stack_overflow"
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import requests
|
||||
from typing import Dict
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class SusiHandler:
|
||||
'''
|
||||
Susi AI Bot
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from zulip_bots.test_lib import (
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
)
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestSusiBot(BotTestCase, DefaultTests):
|
||||
bot_name = "susi"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
from typing import List, Tuple, Any
|
||||
from zulip_bots.game_handler import GameInstance
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestTicTacToeBot(BotTestCase, DefaultTests):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import copy
|
||||
import random
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
from typing import List, Any, Tuple
|
||||
from zulip_bots.game_handler import GameAdapter, BadMoveException
|
||||
from zulip_bots.game_handler import BadMoveException, GameAdapter
|
||||
|
||||
# -------------------------------------
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.bots.trello.trello import TrelloHandler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.test_lib import StubBotHandler
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler
|
||||
|
||||
mock_config = {
|
||||
'api_key': 'TEST',
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from typing import Any, List, Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
supported_commands = [
|
||||
('help', 'Get the bot usage information.'),
|
||||
('list-commands', 'Get information about the commands supported by the bot.'),
|
||||
|
|
|
@ -1,27 +1,18 @@
|
|||
import json
|
||||
import html
|
||||
|
||||
import json
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
from unittest.mock import patch
|
||||
from typing import Optional, Tuple, Any, Dict
|
||||
|
||||
from zulip_bots.test_lib import (
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
read_bot_fixture_data,
|
||||
StubBotHandler,
|
||||
)
|
||||
|
||||
from zulip_bots.request_test_lib import (
|
||||
mock_request_exception,
|
||||
)
|
||||
|
||||
from zulip_bots.bots.trivia_quiz.trivia_quiz import (
|
||||
get_quiz_from_payload,
|
||||
fix_quotes,
|
||||
get_quiz_from_id,
|
||||
update_quiz,
|
||||
get_quiz_from_payload,
|
||||
handle_answer,
|
||||
update_quiz,
|
||||
)
|
||||
from zulip_bots.request_test_lib import mock_request_exception
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, read_bot_fixture_data
|
||||
|
||||
|
||||
class TestTriviaQuizBot(BotTestCase, DefaultTests):
|
||||
bot_name = "trivia_quiz" # type: str
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import html
|
||||
import json
|
||||
import requests
|
||||
import random
|
||||
import re
|
||||
from typing import Optional, Any, Dict, Tuple
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class NotAvailableException(Exception):
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
from zulip_bots.test_lib import (
|
||||
StubBotHandler,
|
||||
BotTestCase,
|
||||
DefaultTests,
|
||||
get_bot_message_handler,
|
||||
)
|
||||
from zulip_bots.test_file_utils import (
|
||||
read_bot_fixture_data,
|
||||
)
|
||||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.test_file_utils import read_bot_fixture_data
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestTwitpostBot(BotTestCase, DefaultTests):
|
||||
bot_name = "twitpost"
|
||||
mock_config = {'consumer_key': 'abcdefghijklmnopqrstuvwxy',
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import tweepy
|
||||
from typing import Dict
|
||||
|
||||
import tweepy
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class TwitpostBot:
|
||||
|
||||
def usage(self) -> str:
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.bots.virtual_fs.virtual_fs import sample_conversation
|
||||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.bots.virtual_fs.virtual_fs import sample_conversation
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestVirtualFsBot(BotTestCase, DefaultTests):
|
||||
bot_name = "virtual_fs"
|
||||
help_txt = ('foo@example.com:\n\nThis bot implements a virtual file system for a stream.\n'
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
import re
|
||||
import os
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, List, Set, Tuple, Union
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class VirtualFsHandler:
|
||||
META = {
|
||||
'name': 'VirtualFs',
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from typing import Optional
|
||||
from unittest.mock import patch
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from typing import Optional
|
||||
|
||||
class TestWeatherBot(BotTestCase, DefaultTests):
|
||||
bot_name = "weather"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
from typing import Any, Dict
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Any, Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
api_url = 'http://api.openweathermap.org/data/2.5/weather'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
from zulip_bots.request_test_lib import mock_request_exception
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestWikipediaBot(BotTestCase, DefaultTests):
|
||||
bot_name = "wikipedia"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import requests
|
||||
import logging
|
||||
from typing import Dict
|
||||
|
||||
import requests
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
# See readme.md for instructions on running this code.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from typing import Any, Dict, Optional
|
||||
from unittest.mock import patch
|
||||
from typing import Dict, Any, Optional
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, get_bot_message_handler, StubBotHandler
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestWitaiBot(BotTestCase, DefaultTests):
|
||||
bot_name = 'witai'
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
|
||||
from typing import Dict, Any, Optional, Callable
|
||||
from zulip_bots.lib import BotHandler
|
||||
import wit
|
||||
import importlib.abc
|
||||
import importlib.util
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
|
||||
import wit
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class WitaiHandler:
|
||||
def usage(self) -> str:
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
|
||||
class TestXkcdBot(BotTestCase, DefaultTests):
|
||||
bot_name = "xkcd"
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import random
|
||||
|
||||
import logging
|
||||
import random
|
||||
from typing import Dict, Optional
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Dict, Optional
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
XKCD_TEMPLATE_URL = 'https://xkcd.com/%s/info.0.json'
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from typing import Optional
|
||||
|
||||
from zulip_bots.bots.yoda.yoda import ServiceUnavailableError
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests
|
||||
|
||||
from typing import Optional
|
||||
|
||||
class TestYodaBot(BotTestCase, DefaultTests):
|
||||
bot_name = "yoda"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# See readme.md for instructions on running this code.
|
||||
import logging
|
||||
import ssl
|
||||
from typing import Dict
|
||||
|
||||
import requests
|
||||
|
||||
from typing import Dict
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
HELP_MESSAGE = '''
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
from unittest.mock import patch
|
||||
from requests.exceptions import HTTPError, ConnectionError
|
||||
|
||||
from zulip_bots.test_lib import StubBotHandler, BotTestCase, DefaultTests, get_bot_message_handler
|
||||
from typing import Dict
|
||||
from unittest.mock import patch
|
||||
|
||||
from requests.exceptions import ConnectionError, HTTPError
|
||||
|
||||
from zulip_bots.test_lib import BotTestCase, DefaultTests, StubBotHandler, get_bot_message_handler
|
||||
|
||||
|
||||
class TestYoutubeBot(BotTestCase, DefaultTests):
|
||||
bot_name = "youtube"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import requests
|
||||
import logging
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
import requests
|
||||
from requests.exceptions import ConnectionError, HTTPError
|
||||
|
||||
from requests.exceptions import HTTPError, ConnectionError
|
||||
from typing import Dict, Union, List, Tuple, Optional
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
commands_list = ('list', 'top', 'help')
|
||||
|
|
|
@ -2,8 +2,8 @@ import importlib
|
|||
import importlib.abc
|
||||
import importlib.util
|
||||
import os
|
||||
from typing import Any, Optional, Text, Tuple
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional, Text, Tuple
|
||||
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import json
|
||||
import re
|
||||
import random
|
||||
import logging
|
||||
from zulip_bots.lib import BotHandler
|
||||
import random
|
||||
import re
|
||||
from copy import deepcopy
|
||||
from typing import Any, Dict, Tuple, List
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
from zulip_bots.lib import BotHandler
|
||||
|
||||
|
||||
class BadMoveException(Exception):
|
||||
|
|
|
@ -2,15 +2,15 @@ import configparser
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import signal
|
||||
import sys
|
||||
import time
|
||||
import re
|
||||
|
||||
|
||||
from contextlib import contextmanager
|
||||
from typing import Any, Iterator, Optional, List, Dict, IO, Set, Text
|
||||
from typing import IO, Any, Dict, Iterator, List, Optional, Set, Text
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from zulip import Client, ZulipError
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import glob
|
||||
import sys
|
||||
from typing import Iterator
|
||||
|
||||
|
||||
def get_bot_paths() -> Iterator[str]:
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
bots_dir = os.path.join(current_dir, "bots")
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import json
|
||||
import requests
|
||||
|
||||
from contextlib import contextmanager
|
||||
from typing import Any, Dict, List
|
||||
from unittest.mock import patch
|
||||
|
||||
from typing import Any, Dict, List
|
||||
import requests
|
||||
|
||||
|
||||
@contextmanager
|
||||
def mock_http_conversation(http_data: Dict[str, Any]) -> Any:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue