Apply Python 3 futurize transform libmodernize.fixes.fix_imports_six
Refer to #256
This commit is contained in:
parent
ab2692b217
commit
f4643de011
|
@ -34,7 +34,7 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from HTMLParser import HTMLParser
|
from six.moves.html_parser import HTMLParser
|
||||||
import six
|
import six
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(__file__))
|
sys.path.insert(0, os.path.dirname(__file__))
|
||||||
|
|
|
@ -27,7 +27,7 @@ from __future__ import print_function
|
||||||
import calendar
|
import calendar
|
||||||
import errno
|
import errno
|
||||||
import hashlib
|
import hashlib
|
||||||
from HTMLParser import HTMLParser
|
from six.moves.html_parser import HTMLParser
|
||||||
import logging
|
import logging
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -27,7 +27,7 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import optparse
|
import optparse
|
||||||
import ConfigParser
|
import six.moves.configparser
|
||||||
|
|
||||||
import zulip
|
import zulip
|
||||||
VERSION = "0.9"
|
VERSION = "0.9"
|
||||||
|
@ -86,14 +86,14 @@ if not options.twitter_id:
|
||||||
parser.error('You must specify --twitter-id')
|
parser.error('You must specify --twitter-id')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.ConfigParser()
|
config = six.moves.configparser.ConfigParser()
|
||||||
config.read(CONFIGFILE)
|
config.read(CONFIGFILE)
|
||||||
|
|
||||||
consumer_key = config.get('twitter', 'consumer_key')
|
consumer_key = config.get('twitter', 'consumer_key')
|
||||||
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 (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
except (six.moves.configparser.NoSectionError, six.moves.configparser.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:
|
||||||
|
@ -118,12 +118,12 @@ if not user.GetId():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
since_id = config.getint('twitter', 'since_id')
|
since_id = config.getint('twitter', 'since_id')
|
||||||
except ConfigParser.NoOptionError:
|
except six.moves.configparser.NoOptionError:
|
||||||
since_id = -1
|
since_id = -1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_id = config.get('twitter', 'user_id')
|
user_id = config.get('twitter', 'user_id')
|
||||||
except ConfigParser.NoOptionError:
|
except six.moves.configparser.NoOptionError:
|
||||||
user_id = options.twitter_id
|
user_id = options.twitter_id
|
||||||
|
|
||||||
client = zulip.Client(
|
client = zulip.Client(
|
||||||
|
|
|
@ -27,7 +27,7 @@ from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import optparse
|
import optparse
|
||||||
import ConfigParser
|
import six.moves.configparser
|
||||||
|
|
||||||
import zulip
|
import zulip
|
||||||
VERSION = "0.9"
|
VERSION = "0.9"
|
||||||
|
@ -108,14 +108,14 @@ if not opts.search_terms:
|
||||||
parser.error('You must specify a search term.')
|
parser.error('You must specify a search term.')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
config = ConfigParser.ConfigParser()
|
config = six.moves.configparser.ConfigParser()
|
||||||
config.read(CONFIGFILE)
|
config.read(CONFIGFILE)
|
||||||
|
|
||||||
consumer_key = config.get('twitter', 'consumer_key')
|
consumer_key = config.get('twitter', 'consumer_key')
|
||||||
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 (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
except (six.moves.configparser.NoSectionError, six.moves.configparser.NoOptionError):
|
||||||
parser.error("Please provide a ~/.zulip_twitterrc")
|
parser.error("Please provide a ~/.zulip_twitterrc")
|
||||||
|
|
||||||
if not (consumer_key and consumer_secret and access_token_key and access_token_secret):
|
if not (consumer_key and consumer_secret and access_token_key and access_token_secret):
|
||||||
|
@ -123,7 +123,7 @@ if not (consumer_key and consumer_secret and access_token_key and access_token_s
|
||||||
|
|
||||||
try:
|
try:
|
||||||
since_id = config.getint('search', 'since_id')
|
since_id = config.getint('search', 'since_id')
|
||||||
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
|
except (six.moves.configparser.NoOptionError, six.moves.configparser.NoSectionError):
|
||||||
since_id = 0
|
since_id = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue