Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import

Refer #256
This commit is contained in:
Eklavya Sharma 2016-03-10 21:45:34 +05:30 committed by Tim Abbott
parent d998bc400a
commit 37365ba5a3
21 changed files with 53 additions and 32 deletions

View file

@ -30,6 +30,7 @@
#
# python-dateutil is a dependency for this script.
from __future__ import print_function
import base64
from datetime import datetime, timedelta
@ -45,8 +46,8 @@ try:
import dateutil.parser
import dateutil.tz
except ImportError as e:
print >>sys.stderr, e
print >>sys.stderr, "Please install the python-dateutil package."
print(e, file=sys.stderr)
print("Please install the python-dateutil package.", file=sys.stderr)
exit(1)
sys.path.insert(0, os.path.dirname(__file__))

View file

@ -29,6 +29,7 @@
#
# python-dateutil is a dependency for this script.
from __future__ import print_function
import requests
import logging
import time
@ -41,8 +42,8 @@ from datetime import datetime, timedelta
try:
import dateutil.parser
except ImportError as e:
print >>sys.stderr, e
print >>sys.stderr, "Please install the python-dateutil package."
print(e, file=sys.stderr)
print("Please install the python-dateutil package.", file=sys.stderr)
exit(1)
sys.path.insert(0, os.path.dirname(__file__))

View file

@ -23,6 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
import calendar
import errno
import hashlib
@ -97,7 +98,7 @@ try:
mkdir_p(opts.data_dir)
except OSError:
# We can't write to the logfile, so just print and give up.
print >>sys.stderr, "Unable to store RSS data at %s." % (opts.data_dir,)
print("Unable to store RSS data at %s." % (opts.data_dir,), file=sys.stderr)
exit(1)
log_file = os.path.join(opts.data_dir, "rss-bot.log")

View file

@ -23,6 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
import os
import sys
import optparse
@ -112,7 +113,7 @@ api = twitter.Api(consumer_key=consumer_key,
user = api.VerifyCredentials()
if not user.GetId():
print "Unable to log in to twitter with supplied credentials. Please double-check and try again"
print("Unable to log in to twitter with supplied credentials. Please double-check and try again")
sys.exit()
try:
@ -154,7 +155,7 @@ for status in statuses[::-1][:options.limit_tweets]:
if ret['result'] == 'error':
# If sending failed (e.g. no such stream), abort and retry next time
print "Error sending message to zulip: %s" % ret['msg']
print("Error sending message to zulip: %s" % ret['msg'])
break
else:
since_id = status.GetId()

View file

@ -23,6 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
import os
import sys
import optparse
@ -138,8 +139,8 @@ api = twitter.Api(consumer_key=consumer_key,
user = api.VerifyCredentials()
if not user.GetId():
print "Unable to log in to Twitter with supplied credentials.\
Please double-check and try again."
print("Unable to log in to Twitter with supplied credentials.\
Please double-check and try again.")
sys.exit()
client = zulip.Client(
@ -182,7 +183,7 @@ for status in statuses[::-1][:opts.limit_tweets]:
if ret['result'] == 'error':
# If sending failed (e.g. no such stream), abort and retry next time
print "Error sending message to zulip: %s" % ret['msg']
print("Error sending message to zulip: %s" % ret['msg'])
break
else:
since_id = status.GetId()