typing: Convert function type annotations to Python 3 style.

Generated by com2ann (slightly patched to avoid also converting
assignment type annotations, which require Python 3.6), followed by
some manual whitespace adjustment, and two fixes for use-before-define
issues:

-    def set_zulip_client(self, zulipToJabberClient: ZulipToJabberBot) -> None:
+    def set_zulip_client(self, zulipToJabberClient: 'ZulipToJabberBot') -> None:

-def init_from_options(options: Any, client: Optional[str] = None) -> Client:
+def init_from_options(options: Any, client: Optional[str] = None) -> 'Client':

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-04-18 15:59:12 -07:00 committed by Tim Abbott
parent 7c5f73dce9
commit 5428c5f296
42 changed files with 311 additions and 577 deletions

View file

@ -15,8 +15,7 @@ directory structure is currently:
fixtures/
'''
def get_bot_message_handler(bot_name):
# type: (str) -> Any
def get_bot_message_handler(bot_name: str) -> Any:
# message_handler is of type 'Any', since it can contain any bot's
# handler class. Eventually, we want bot's handler classes to
# inherit from a common prototype specifying the handle_message
@ -24,8 +23,7 @@ def get_bot_message_handler(bot_name):
lib_module = import_module('zulip_bots.bots.{bot}.{bot}'.format(bot=bot_name)) # type: Any
return lib_module.handler_class()
def read_bot_fixture_data(bot_name, test_name):
# type: (str, str) -> Dict[str, Any]
def read_bot_fixture_data(bot_name: str, test_name: str) -> Dict[str, Any]:
base_path = os.path.realpath(os.path.join(os.path.dirname(
os.path.abspath(__file__)), 'bots', bot_name, 'fixtures'))
http_data_path = os.path.join(base_path, '{}.json'.format(test_name))