mypy: Amend hg integration to simplify error handling/typing.

This commit is contained in:
neiljp (Neil Pilgrim) 2018-01-07 09:06:18 -08:00 committed by showell
parent d26e44ebb2
commit 55df1886cc

View file

@ -106,12 +106,13 @@ def send_zulip(email, api_key, site, stream, subject, content):
client.send_message(message_data) client.send_message(message_data)
def get_config(ui, item): def get_config(ui, item):
# type: (ui, str) -> Optional[str] # type: (ui, str) -> str
try: try:
# configlist returns everything in lists. # configlist returns everything in lists.
return ui.configlist('zulip', item)[0] return ui.configlist('zulip', item)[0]
except IndexError: except IndexError:
return None ui.warn("Zulip: Could not find required item {} in hg config.".format(item))
exit(1)
def hook(ui, repo, **kwargs): def hook(ui, repo, **kwargs):
# type: (ui, repo, **Text) -> None # type: (ui, repo, **Text) -> None