Apply Python 3 futurize transform libmodernize.fixes.fix_imports_six

Refer to #256
This commit is contained in:
Eklavya Sharma 2016-03-10 22:58:02 +05:30 committed by Tim Abbott
parent def027a1ec
commit 7b8cb105bf
6 changed files with 15 additions and 15 deletions

View File

@ -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__))

View 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

View File

@ -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(

View File

@ -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:

View File

@ -2,7 +2,7 @@
import sys import sys
import subprocess import subprocess
import ConfigParser import six.moves.configparser
import re import re
force = False force = False
@ -12,7 +12,7 @@ if len(extra_args) and extra_args[0] in ('-f', '--force'):
force = True force = True
extra_args = extra_args[1:] extra_args = extra_args[1:]
config = ConfigParser.RawConfigParser() config = six.moves.configparser.RawConfigParser()
config.read("/etc/zulip/zulip.conf") config.read("/etc/zulip/zulip.conf")
puppet_config = """ puppet_config = """

View File

@ -83,7 +83,7 @@ Qual a diferen
""" """
from __future__ import print_function from __future__ import print_function
import socket, thread, select import socket, six.moves._thread, select
PORT = 8085 PORT = 8085
__version__ = '0.1.0 Draft 1' __version__ = '0.1.0 Draft 1'
@ -239,7 +239,7 @@ def start_server(host='localhost', port=PORT, IPv6=False, timeout=60,
print("Serving on %s:%d." % (host, port)) #debug print("Serving on %s:%d." % (host, port)) #debug
soc.listen(0) soc.listen(0)
while True: while True:
thread.start_new_thread(handler, soc.accept()+(timeout,)) six.moves._thread.start_new_thread(handler, soc.accept()+(timeout,))
if __name__ == '__main__': if __name__ == '__main__':
start_server() start_server()