From 6f40bcf745b8a27624005de71f034296a9b1ffaa Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 18 Apr 2020 17:16:37 -0700 Subject: [PATCH] cleanup: Fix whitespace around parameter equals. Signed-off-by: Anders Kaseorg --- .../bots/connect_four/test_connect_four.py | 6 ++--- .../bots/game_handler_bot/game_handler_bot.py | 2 +- .../game_handler_bot/test_game_handler_bot.py | 24 ++++++++--------- .../bots/game_of_fifteen/game_of_fifteen.py | 4 +-- .../game_of_fifteen/test_game_of_fifteen.py | 6 ++--- .../zulip_bots/bots/idonethis/idonethis.py | 8 +++--- zulip_bots/zulip_bots/bots/merels/merels.py | 4 +-- .../zulip_bots/bots/merels/test_merels.py | 2 +- .../zulip_bots/bots/salesforce/salesforce.py | 8 +++--- .../bots/salesforce/test_salesforce.py | 4 +-- .../zulip_bots/bots/tictactoe/tictactoe.py | 4 +-- .../bots/trivia_quiz/test_trivia_quiz.py | 2 +- .../zulip_bots/bots/weather/test_weather.py | 2 +- zulip_bots/zulip_bots/bots/xkcd/xkcd.py | 2 +- zulip_bots/zulip_bots/bots/yoda/test_yoda.py | 2 +- zulip_bots/zulip_bots/game_handler.py | 26 +++++++++---------- zulip_bots/zulip_bots/lib.py | 10 +++---- zulip_bots/zulip_bots/test_lib.py | 6 ++--- zulip_botserver/tests/server_test_lib.py | 14 +++++----- zulip_botserver/zulip_botserver/server.py | 4 +-- 20 files changed, 70 insertions(+), 70 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py b/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py index 792658c..3e091b9 100644 --- a/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py +++ b/zulip_bots/zulip_bots/bots/connect_four/test_connect_four.py @@ -11,8 +11,8 @@ class TestConnectFourBot(BotTestCase, DefaultTests): def make_request_message( self, content: str, - user: str='foo@example.com', - user_name: str='foo' + user: str = 'foo@example.com', + user_name: str = 'foo' ) -> Dict[str, str]: message = dict( sender_email=user, @@ -22,7 +22,7 @@ class TestConnectFourBot(BotTestCase, DefaultTests): return message # Function that serves similar purpose to BotTestCase.verify_dialog, but allows for multiple responses to be handled - def verify_response(self, request: str, expected_response: str, response_number: int, user: str='foo@example.com') -> None: + def verify_response(self, request: str, expected_response: str, response_number: int, user: str = 'foo@example.com') -> None: ''' This function serves a similar purpose to BotTestCase.verify_dialog, but allows diff --git a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py b/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py index 3c52218..6cd168c 100644 --- a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py +++ b/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py @@ -29,7 +29,7 @@ class MockModel: self, move: str, player: int, - is_computer: bool=False + is_computer: bool = False ) -> Any: if not is_computer: if int(move.replace('move ', '')) < 9: diff --git a/zulip_bots/zulip_bots/bots/game_handler_bot/test_game_handler_bot.py b/zulip_bots/zulip_bots/bots/game_handler_bot/test_game_handler_bot.py index 55b4a2f..e6cf9fd 100644 --- a/zulip_bots/zulip_bots/bots/game_handler_bot/test_game_handler_bot.py +++ b/zulip_bots/zulip_bots/bots/game_handler_bot/test_game_handler_bot.py @@ -12,11 +12,11 @@ class TestGameHandlerBot(BotTestCase, DefaultTests): def make_request_message( self, content: str, - user: str='foo@example.com', - user_name: str='foo', - type: str='private', - stream: str='', - subject: str='' + user: str = 'foo@example.com', + user_name: str = 'foo', + type: str = 'private', + stream: str = '', + subject: str = '' ) -> Dict[str, str]: message = dict( sender_email=user, @@ -34,11 +34,11 @@ class TestGameHandlerBot(BotTestCase, DefaultTests): request: str, expected_response: str, response_number: int, - bot: Any=None, - user_name: str='foo', - stream: str='', - subject: str='', - max_messages: int=20 + bot: Any = None, + user_name: str = 'foo', + stream: str = '', + subject: str = '', + max_messages: int = 20 ) -> None: ''' This function serves a similar purpose @@ -65,7 +65,7 @@ class TestGameHandlerBot(BotTestCase, DefaultTests): self.assertEqual(expected_response, first_response['content']) self.assertLessEqual(len(responses), max_messages) - def add_user_to_cache(self, name: str, bot: Any=None) -> Any: + def add_user_to_cache(self, name: str, bot: Any = None) -> Any: if bot is None: bot, bot_handler = self._get_handlers() message = { @@ -75,7 +75,7 @@ class TestGameHandlerBot(BotTestCase, DefaultTests): bot.add_user_to_cache(message) return bot - def setup_game(self, id: str='', bot: Any=None, players: List[str]=['foo', 'baz'], subject: str='test game', stream: str='test') -> Any: + def setup_game(self, id: str = '', bot: Any = None, players: List[str] = ['foo', 'baz'], subject: str = 'test game', stream: str = 'test') -> Any: if bot is None: bot, bot_handler = self._get_handlers() for p in players: diff --git a/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py b/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py index 27038f1..3706445 100644 --- a/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py +++ b/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py @@ -13,7 +13,7 @@ class GameOfFifteenModel: [5, 4, 3], [2, 1, 0]] - def __init__(self, board: Any=None) -> None: + def __init__(self, board: Any = None) -> None: if board is not None: self.current_board = board else: @@ -52,7 +52,7 @@ class GameOfFifteenModel: def update_board(self, board): self.current_board = copy.deepcopy(board) - def make_move(self, move: str, player_number: int, computer_move: bool=False) -> Any: + def make_move(self, move: str, player_number: int, computer_move: bool = False) -> Any: board = self.current_board move = move.strip() move = move.split(' ') diff --git a/zulip_bots/zulip_bots/bots/game_of_fifteen/test_game_of_fifteen.py b/zulip_bots/zulip_bots/bots/game_of_fifteen/test_game_of_fifteen.py index 105f7b3..0fc1276 100644 --- a/zulip_bots/zulip_bots/bots/game_of_fifteen/test_game_of_fifteen.py +++ b/zulip_bots/zulip_bots/bots/game_of_fifteen/test_game_of_fifteen.py @@ -11,8 +11,8 @@ class TestGameOfFifteenBot(BotTestCase, DefaultTests): def make_request_message( self, content: str, - user: str='foo@example.com', - user_name: str='foo' + user: str = 'foo@example.com', + user_name: str = 'foo' ) -> Dict[str, str]: message = dict( sender_email=user, @@ -22,7 +22,7 @@ class TestGameOfFifteenBot(BotTestCase, DefaultTests): return message # Function that serves similar purpose to BotTestCase.verify_dialog, but allows for multiple responses to be handled - def verify_response(self, request: str, expected_response: str, response_number: int, user: str='foo@example.com') -> None: + def verify_response(self, request: str, expected_response: str, response_number: int, user: str = 'foo@example.com') -> None: ''' This function serves a similar purpose to BotTestCase.verify_dialog, but allows diff --git a/zulip_bots/zulip_bots/bots/idonethis/idonethis.py b/zulip_bots/zulip_bots/bots/idonethis/idonethis.py index cec1f1f..d119d8e 100644 --- a/zulip_bots/zulip_bots/bots/idonethis/idonethis.py +++ b/zulip_bots/zulip_bots/bots/idonethis/idonethis.py @@ -24,9 +24,9 @@ class UnspecifiedProblemException(Exception): pass def make_API_request(endpoint: str, - method: str="GET", - body: Optional[Dict[str, str]]=None, - params: Optional[Dict[str, str]]=None) -> Any: + method: str = "GET", + body: Optional[Dict[str, str]] = None, + params: Optional[Dict[str, str]] = None) -> Any: headers = {'Authorization': 'Token ' + api_key} if method == "GET": r = requests.get(API_BASE_URL + endpoint, headers=headers, params=params) @@ -54,7 +54,7 @@ def api_show_team(hash_id: str) -> Dict[str, str]: def api_show_users(hash_id: str) -> Any: return make_API_request("/teams/{}/members".format(hash_id)) -def api_list_entries(team_id: Optional[str]=None) -> List[Dict[str, Any]]: +def api_list_entries(team_id: Optional[str] = None) -> List[Dict[str, Any]]: if team_id: return make_API_request("/entries", params=dict(team_id=team_id)) else: diff --git a/zulip_bots/zulip_bots/bots/merels/merels.py b/zulip_bots/zulip_bots/bots/merels/merels.py index 941f481..85d4e38 100644 --- a/zulip_bots/zulip_bots/bots/merels/merels.py +++ b/zulip_bots/zulip_bots/bots/merels/merels.py @@ -21,7 +21,7 @@ class Storage: class MerelsModel: - def __init__(self, board: Any=None) -> None: + def __init__(self, board: Any = None) -> None: self.topic = "merels" self.storage = Storage(self.topic) self.current_board = mechanics.display_game(self.topic, self.storage) @@ -42,7 +42,7 @@ class MerelsModel: return True return False - def make_move(self, move: str, player_number: int, computer_move: bool=False) -> Any: + def make_move(self, move: str, player_number: int, computer_move: bool = False) -> Any: if self.storage.get(self.topic) == '["X", 0, 0, "NNNNNNNNNNNNNNNNNNNNNNNN", "", 0]': self.storage.put( self.topic, diff --git a/zulip_bots/zulip_bots/bots/merels/test_merels.py b/zulip_bots/zulip_bots/bots/merels/test_merels.py index 9f05080..f37d5fc 100644 --- a/zulip_bots/zulip_bots/bots/merels/test_merels.py +++ b/zulip_bots/zulip_bots/bots/merels/test_merels.py @@ -48,7 +48,7 @@ class TestMerelsBot(BotTestCase, DefaultTests): def test_setup_game(self): self.setup_game() - def add_user_to_cache(self, name: str, bot: Any=None) -> Any: + def add_user_to_cache(self, name: str, bot: Any = None) -> Any: if bot is None: bot, bot_handler = self._get_handlers() message = { diff --git a/zulip_bots/zulip_bots/bots/salesforce/salesforce.py b/zulip_bots/zulip_bots/bots/salesforce/salesforce.py index 5f361e6..6ebdf47 100644 --- a/zulip_bots/zulip_bots/bots/salesforce/salesforce.py +++ b/zulip_bots/zulip_bots/bots/salesforce/salesforce.py @@ -39,10 +39,10 @@ def get_help_text() -> str: def format_result( result: Dict[str, Any], - exclude_keys: List[str]=[], - force_keys: List[str]=[], - rank_output: bool=False, - show_all_keys: bool=False + exclude_keys: List[str] = [], + force_keys: List[str] = [], + rank_output: bool = False, + show_all_keys: bool = False ) -> str: exclude_keys += ['Name', 'attributes', 'Id'] output = '' diff --git a/zulip_bots/zulip_bots/bots/salesforce/test_salesforce.py b/zulip_bots/zulip_bots/bots/salesforce/test_salesforce.py index 656f29a..ed4ca26 100644 --- a/zulip_bots/zulip_bots/bots/salesforce/test_salesforce.py +++ b/zulip_bots/zulip_bots/bots/salesforce/test_salesforce.py @@ -108,14 +108,14 @@ mock_object_types = { class TestSalesforceBot(BotTestCase, DefaultTests): bot_name = "salesforce" # type: str - def _test(self, test_name: str, message: str, response: str, auth_success: bool=True) -> None: + def _test(self, test_name: str, message: str, response: str, auth_success: bool = True) -> None: with self.mock_config_info(mock_config), \ mock_salesforce_auth(auth_success), \ mock_salesforce_query(test_name, 'salesforce'), \ mock_salesforce_commands_types(): self.verify_reply(message, response) - def _test_initialize(self, auth_success: bool=True) -> None: + def _test_initialize(self, auth_success: bool = True) -> None: with self.mock_config_info(mock_config), \ mock_salesforce_auth(auth_success), \ mock_salesforce_commands_types(): diff --git a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py index 99924d5..7676deb 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py +++ b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py @@ -27,7 +27,7 @@ class TicTacToeModel: [0, 0, 0], [0, 0, 0]] - def __init__(self, board: Any=None) -> None: + def __init__(self, board: Any = None) -> None: if board is not None: self.current_board = board else: @@ -190,7 +190,7 @@ class TicTacToeModel: valid = False return valid - def make_move(self, move: str, player_number: int, computer_move: bool=False) -> Any: + def make_move(self, move: str, player_number: int, computer_move: bool = False) -> Any: if computer_move: return self.computer_move(self.current_board, player_number + 1) move_coords_str = coords_from_command(move) diff --git a/zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py b/zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py index 56ceab0..525afd4 100644 --- a/zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py +++ b/zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py @@ -40,7 +40,7 @@ class TestTriviaQuizBot(BotTestCase, DefaultTests): quiz = get_quiz_from_payload(quiz_payload) return quiz, bot_handler - def _test(self, message: str, response: str, fixture: Optional[str]=None) -> None: + def _test(self, message: str, response: str, fixture: Optional[str] = None) -> None: if fixture: with self.mock_http_conversation(fixture): self.verify_reply(message, response) diff --git a/zulip_bots/zulip_bots/bots/weather/test_weather.py b/zulip_bots/zulip_bots/bots/weather/test_weather.py index ee9506e..aa0e695 100644 --- a/zulip_bots/zulip_bots/bots/weather/test_weather.py +++ b/zulip_bots/zulip_bots/bots/weather/test_weather.py @@ -16,7 +16,7 @@ class TestWeatherBot(BotTestCase, DefaultTests): @**Weather Bot** Portland, Me '''.strip() - def _test(self, message: str, response: str, fixture: Optional[str]=None) -> None: + def _test(self, message: str, response: str, fixture: Optional[str] = None) -> None: with self.mock_config_info({'key': '123456'}): if fixture: with self.mock_http_conversation(fixture): diff --git a/zulip_bots/zulip_bots/bots/xkcd/xkcd.py b/zulip_bots/zulip_bots/bots/xkcd/xkcd.py index 96df848..79fe62c 100644 --- a/zulip_bots/zulip_bots/bots/xkcd/xkcd.py +++ b/zulip_bots/zulip_bots/bots/xkcd/xkcd.py @@ -85,7 +85,7 @@ def get_xkcd_bot_response(message: Dict[str, str], quoted_name: str) -> str: fetched['alt'], fetched['img'])) -def fetch_xkcd_query(mode: int, comic_id: Optional[str]=None) -> Dict[str, str]: +def fetch_xkcd_query(mode: int, comic_id: Optional[str] = None) -> Dict[str, str]: try: if mode == XkcdBotCommand.LATEST: # Fetch the latest comic strip. url = LATEST_XKCD_URL diff --git a/zulip_bots/zulip_bots/bots/yoda/test_yoda.py b/zulip_bots/zulip_bots/bots/yoda/test_yoda.py index 3ebbde3..0b1689e 100644 --- a/zulip_bots/zulip_bots/bots/yoda/test_yoda.py +++ b/zulip_bots/zulip_bots/bots/yoda/test_yoda.py @@ -20,7 +20,7 @@ class TestYodaBot(BotTestCase, DefaultTests): @mention-bot You will learn how to speak like me someday. ''' - def _test(self, message: str, response: str, fixture: Optional[str]=None) -> None: + def _test(self, message: str, response: str, fixture: Optional[str] = None) -> None: with self.mock_config_info({'api_key': '12345678'}): if fixture is not None: with self.mock_http_conversation(fixture): diff --git a/zulip_bots/zulip_bots/game_handler.py b/zulip_bots/zulip_bots/game_handler.py index 4e89d0d..8e22a9a 100644 --- a/zulip_bots/zulip_bots/game_handler.py +++ b/zulip_bots/zulip_bots/game_handler.py @@ -37,9 +37,9 @@ class GameAdapter: model: Any, gameMessageHandler: Any, rules: str, - max_players: int=2, - min_players: int=2, - supports_computer: bool=False + max_players: int = 2, + min_players: int = 2, + supports_computer: bool = False ) -> None: self.game_name = game_name self.bot_name = bot_name @@ -152,7 +152,7 @@ class GameAdapter: host = self.invites[game_id]['host'] return 'Declined invitation to play **{}** from @**{}**.'.format(self.game_name, self.get_username_by_email(host)) - def send_message(self, to: str, content: str, is_private: bool, subject: str='') -> None: + def send_message(self, to: str, content: str, is_private: bool, subject: str = '') -> None: self.bot_handler.send_message(dict( type='private' if is_private else 'stream', to=to, @@ -306,7 +306,7 @@ class GameAdapter: game_id, '@**{}** has accepted the invitation.'.format(self.get_username_by_email(sender))) self.start_game_if_ready(game_id) - def create_game_lobby(self, message: Dict[str, Any], users: List[str]=[]) -> None: + def create_game_lobby(self, message: Dict[str, Any], users: List[str] = []) -> None: if self.is_game_in_subject(message['subject'], message['display_recipient']): self.send_reply(message, 'There is already a game in this stream.') return @@ -448,13 +448,13 @@ class GameAdapter: reverse=True ) - def send_invite(self, game_id: str, user_email: str, message: Dict[str, Any]={}) -> None: + def send_invite(self, game_id: str, user_email: str, message: Dict[str, Any] = {}) -> None: self.invites[game_id].update({user_email.lower(): 'p'}) self.send_message(user_email, self.alert_new_invitation(game_id), True) if message != {}: self.send_reply(message, self.confirm_new_invitation(user_email)) - def cancel_game(self, game_id: str, reason: str='') -> None: + def cancel_game(self, game_id: str, reason: str = '') -> None: if game_id in self.invites.keys(): self.broadcast(game_id, 'Game cancelled.\n' + reason) del self.invites[game_id] @@ -494,7 +494,7 @@ class GameAdapter: instance.stream, instance.subject) return object - def join_game(self, game_id: str, user_email: str, message: Dict[str, Any]={}) -> None: + def join_game(self, game_id: str, user_email: str, message: Dict[str, Any] = {}) -> None: if len(self.get_players(game_id)) >= self.max_players: if message != {}: self.send_reply(message, 'This game is full.') @@ -504,7 +504,7 @@ class GameAdapter: game_id, '@**{}** has joined the game'.format(self.get_username_by_email(user_email))) self.start_game_if_ready(game_id) - def get_players(self, game_id: str, parameter: str='a') -> List[str]: + def get_players(self, game_id: str, parameter: str = 'a') -> List[str]: if game_id in self.invites.keys(): players = [] # type: List[str] if (self.invites[game_id]['subject'] == '###private###' and 'p' in parameter) or 'p' not in parameter: @@ -587,7 +587,7 @@ To move subjects, send your message again, otherwise join the game using the lin game_id: str, stream_name: str, subject_name: str, - message: Dict[str, Any]={} + message: Dict[str, Any] = {} ) -> None: if self.get_game_instance_by_subject(stream_name, subject_name) is not None: if message != {}: @@ -642,7 +642,7 @@ To move subjects, send your message again, otherwise join the game using the lin self.user_cache = json.loads(user_cache_str) return self.user_cache - def verify_users(self, users: List[str], message: Dict[str, Any]={}) -> List[str]: + def verify_users(self, users: List[str], message: Dict[str, Any] = {}) -> List[str]: verified_users = [] failed = False for u in users: @@ -684,7 +684,7 @@ To move subjects, send your message again, otherwise join the game using the lin self.get_game_instance_by_subject( subject_name, stream_name) is not None - def is_user_not_player(self, user_email: str, message: Dict[str, Any]={}) -> bool: + def is_user_not_player(self, user_email: str, message: Dict[str, Any] = {}) -> bool: user = self.get_user_by_email(user_email) if user == {}: if message != {}: @@ -710,7 +710,7 @@ To move subjects, send your message again, otherwise join the game using the lin id += valid_characters[random.randrange(0, len(valid_characters))] return id - def broadcast(self, game_id: str, content: str, include_private: bool=True) -> bool: + def broadcast(self, game_id: str, content: str, include_private: bool = True) -> bool: if include_private: private_recipients = self.get_players(game_id, parameter='p') if private_recipients is not None: diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index a2ea6d2..93783a2 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -108,8 +108,8 @@ class ExternalBotHandler: client: Client, root_dir: str, bot_details: Dict[str, Any], - bot_config_file: Optional[str]=None, - bot_config_parser: Optional[configparser.ConfigParser]=None, + bot_config_file: Optional[str] = None, + bot_config_parser: Optional[configparser.ConfigParser] = None, ) -> None: # Only expose a subset of our Client's functionality try: @@ -161,7 +161,7 @@ class ExternalBotHandler: print("ERROR!: " + str(resp)) return resp - def send_reply(self, message: Dict[str, Any], response: str, widget_content: Optional[str]=None) -> Dict[str, Any]: + def send_reply(self, message: Dict[str, Any], response: str, widget_content: Optional[str] = None) -> Dict[str, Any]: if message['type'] == 'private': return self.send_message(dict( type='private', @@ -183,7 +183,7 @@ class ExternalBotHandler: self._rate_limit.show_error_and_exit() return self._client.update_message(message) - def get_config_info(self, bot_name: str, optional: Optional[bool]=False) -> Dict[str, Any]: + def get_config_info(self, bot_name: str, optional: Optional[bool] = False) -> Dict[str, Any]: if self._bot_config_parser is not None: config_parser = self._bot_config_parser else: @@ -245,7 +245,7 @@ class ExternalBotHandler: raise PermissionError("Cannot open file \"{}\". Bots may only access " "files in their local directory.".format(abs_filepath)) - def quit(self, message: str="") -> None: + def quit(self, message: str = "") -> None: sys.exit(message) diff --git a/zulip_bots/zulip_bots/test_lib.py b/zulip_bots/zulip_bots/test_lib.py index 4476748..0bc0874 100755 --- a/zulip_bots/zulip_bots/test_lib.py +++ b/zulip_bots/zulip_bots/test_lib.py @@ -42,7 +42,7 @@ class StubBotHandler: return self.message_server.send(message) def send_reply(self, message: Dict[str, Any], response: str, - widget_content: Optional[str]=None) -> Dict[str, Any]: + widget_content: Optional[str] = None) -> Dict[str, Any]: response_message = dict( content=response, widget_content=widget_content @@ -63,10 +63,10 @@ class StubBotHandler: class BotQuitException(Exception): pass - def quit(self, message: str="") -> None: + def quit(self, message: str = "") -> None: raise self.BotQuitException() - def get_config_info(self, bot_name: str, optional: bool=False) -> Dict[str, Any]: + def get_config_info(self, bot_name: str, optional: bool = False) -> Dict[str, Any]: return {} def unique_reply(self) -> Dict[str, Any]: diff --git a/zulip_botserver/tests/server_test_lib.py b/zulip_botserver/tests/server_test_lib.py index 97edca6..a90e02a 100644 --- a/zulip_botserver/tests/server_test_lib.py +++ b/zulip_botserver/tests/server_test_lib.py @@ -17,13 +17,13 @@ class BotServerTestCase(TestCase): def assert_bot_server_response( self, mock_ExternalBotHandler: mock.Mock, - available_bots: Optional[List[str]]=None, - bots_config: Optional[Dict[str, Dict[str, str]]]=None, - bot_handlers: Optional[Dict[str, Any]]=None, - event: Optional[Dict[str, Any]]=None, - expected_response: Optional[str]=None, - check_success: bool=False, - third_party_bot_conf: Optional[configparser.ConfigParser]=None, + available_bots: Optional[List[str]] = None, + bots_config: Optional[Dict[str, Dict[str, str]]] = None, + bot_handlers: Optional[Dict[str, Any]] = None, + event: Optional[Dict[str, Any]] = None, + expected_response: Optional[str] = None, + check_success: bool = False, + third_party_bot_conf: Optional[configparser.ConfigParser] = None, ) -> None: if available_bots is not None and bots_config is not None: server.bots_config = bots_config diff --git a/zulip_botserver/zulip_botserver/server.py b/zulip_botserver/zulip_botserver/server.py index ce7aa4d..6ad6762 100644 --- a/zulip_botserver/zulip_botserver/server.py +++ b/zulip_botserver/zulip_botserver/server.py @@ -29,7 +29,7 @@ def read_config_section(parser: configparser.ConfigParser, section: str) -> Dict return section_info -def read_config_file(config_file_path: str, bot_name: Optional[str]=None) -> Dict[str, Dict[str, str]]: +def read_config_file(config_file_path: str, bot_name: Optional[str] = None) -> Dict[str, Dict[str, str]]: parser = parse_config_file(config_file_path) bots_config = {} # type: Dict[str, Dict[str, str]] @@ -102,7 +102,7 @@ def load_lib_modules(available_bots: List[str]) -> Dict[str, Any]: def load_bot_handlers( available_bots: List[str], bots_config: Dict[str, Dict[str, str]], - third_party_bot_conf: Optional[configparser.ConfigParser]=None, + third_party_bot_conf: Optional[configparser.ConfigParser] = None, ) -> Dict[str, lib.ExternalBotHandler]: bot_handlers = {} for bot in available_bots: