From 836e3379c9ec33d88611c924697ad6b51678791a 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 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bots/gcal-bot b/bots/gcal-bot index 87a97f1..a7728df 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 = []