mypy: Get rid of six.moves.configparser and add appropriate classes.

This commit is contained in:
Joshua Pan 2016-12-30 02:07:46 +00:00 committed by Tim Abbott
parent 6b52b51db6
commit f9104fb7e4

View file

@ -27,8 +27,7 @@ from __future__ import print_function
import os import os
import sys import sys
import optparse import optparse
import six.moves.configparser from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError
from six.moves.configparser import ConfigParser
import zulip import zulip
VERSION = "0.9" VERSION = "0.9"
@ -99,7 +98,7 @@ try:
consumer_secret = config.get('twitter', 'consumer_secret') consumer_secret = config.get('twitter', 'consumer_secret')
access_token_key = config.get('twitter', 'access_token_key') access_token_key = config.get('twitter', 'access_token_key')
access_token_secret = config.get('twitter', 'access_token_secret') 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") parser.error("Please provide a ~/.zulip_twitterrc")
if not consumer_key or not consumer_secret or not access_token_key or not access_token_secret: if not consumer_key or not consumer_secret or not access_token_key or not access_token_secret:
@ -124,12 +123,12 @@ if not user.id:
try: try:
since_id = config.getint('twitter', 'since_id') since_id = config.getint('twitter', 'since_id')
except six.moves.configparser.NoOptionError: except NoOptionError:
since_id = -1 since_id = -1
try: try:
user_id = config.get('twitter', 'user_id') user_id = config.get('twitter', 'user_id')
except six.moves.configparser.NoOptionError: except NoOptionError:
user_id = options.twitter_id user_id = options.twitter_id
client = zulip.Client( client = zulip.Client(