mirror of https://github.com/zulip/zulip.git
mypy: Annotate bots/gcal-bot.
This commit is contained in:
parent
558d359909
commit
ba7d4e7452
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue