From ba7d4e7452ceafe086c8c89b67a045d7fea56f3e Mon Sep 17 00:00:00 2001 From: Heidi Dong Date: Wed, 30 Nov 2016 04:05:00 +0000 Subject: [PATCH] mypy: Annotate bots/gcal-bot. --- bots/gcal-bot | 8 ++++++-- tools/run-mypy | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bots/gcal-bot b/bots/gcal-bot index 87a97f1d48..a7728df899 100755 --- a/bots/gcal-bot +++ b/bots/gcal-bot @@ -11,6 +11,7 @@ import os sys.path.append(os.path.join(os.path.dirname(__file__), '../api')) import zulip +from typing import List, Set, Tuple, Iterable, Optional parser = optparse.OptionParser(r""" @@ -57,6 +58,7 @@ except ImportError: parser.error('Install python-gdata') def get_calendar_url(): + # type: () -> str parts = urllib.parse.urlparse(options.calendar) pat = os.path.split(parts.path) if pat[1] != 'basic': @@ -70,6 +72,7 @@ calendar_url = get_calendar_url() client = zulip.init_from_options(options) def get_events(): + # type: () -> Iterable[Tuple[int, datetime.datetime, str]] feed = CalendarClient().GetCalendarEventFeed(uri=calendar_url) for event in feed.entry: @@ -80,12 +83,13 @@ def get_events(): yield (event.uid.value, start, event.title.text) # Our cached view of the calendar, updated periodically. -events = [] +events = [] # type: List[Tuple[int, datetime.datetime, str]] # Unique keys for events we've already sent, so we don't remind twice. -sent = set() +sent = set() # type: Set[Tuple[int, datetime.datetime]] def send_reminders(): + # type: () -> Optional[None] global sent messages = [] diff --git a/tools/run-mypy b/tools/run-mypy index 3dad28cc2d..1694e0ec54 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -37,7 +37,6 @@ api/integrations/svn/post-commit api/integrations/twitter/twitter-bot api/integrations/twitter/twitter-search-bot api/zulip/__init__.py -bots/gcal-bot bots/githook-post-receive bots/jabber_mirror_backend.py bots/zephyr_mirror_backend.py