From 1010927188c8367c3047b69a0f315cf78878a274 Mon Sep 17 00:00:00 2001 From: Sampriti Panda Date: Sun, 1 Jan 2017 02:01:28 +0530 Subject: [PATCH] mypy: Annotate api/integrations/twitter/twitter-search-bot --- integrations/twitter/twitter-search-bot | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/integrations/twitter/twitter-search-bot b/integrations/twitter/twitter-search-bot index 93e3538..a10bca7 100755 --- a/integrations/twitter/twitter-search-bot +++ b/integrations/twitter/twitter-search-bot @@ -27,13 +27,14 @@ from __future__ import print_function import os import sys import optparse -import six.moves.configparser +from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError import zulip VERSION = "0.9" CONFIGFILE = os.path.expanduser("~/.zulip_twitterrc") def write_config(config, since_id): + # type: (ConfigParser, int) -> None if 'search' not in config.sections(): config.add_section('search') config.set('search', 'since_id', since_id) @@ -111,14 +112,14 @@ if not opts.search_terms: parser.error('You must specify a search term.') try: - config = six.moves.configparser.ConfigParser() + config = ConfigParser() config.read(CONFIGFILE) consumer_key = config.get('twitter', 'consumer_key') consumer_secret = config.get('twitter', 'consumer_secret') access_token_key = config.get('twitter', 'access_token_key') access_token_secret = config.get('twitter', 'access_token_secret') -except (six.moves.configparser.NoSectionError, six.moves.configparser.NoOptionError): +except (NoSectionError, NoOptionError): parser.error("Please provide a ~/.zulip_twitterrc") if not (consumer_key and consumer_secret and access_token_key and access_token_secret): @@ -126,7 +127,7 @@ if not (consumer_key and consumer_secret and access_token_key and access_token_s try: since_id = config.getint('search', 'since_id') -except (six.moves.configparser.NoOptionError, six.moves.configparser.NoSectionError): +except (NoOptionError, NoSectionError): since_id = 0 try: