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

@ -1,4 +1,5 @@
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import time
import optparse
@ -100,7 +101,7 @@ def print_status_and_exit(status):
# e.g. true success and punting due to a SERVNAK, result in a
# non-alert case, so to give us something unambiguous to check in
# Nagios, print the exit status.
print status
print(status)
sys.exit(status)
def send_zulip(message):

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import time
import optparse
@ -15,7 +16,7 @@ states = {
}
if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
print "This script must be run as the root or rabbitmq user"
print("This script must be run as the root or rabbitmq user")
usage = """Usage: check-rabbitmq-consumers --queue=[queue-name] --min-threshold=[min-threshold]"""

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import re
import time
@ -30,7 +31,7 @@ max_count = 0
warn_queues = []
if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
print "This script must be run as the root or rabbitmq user"
print("This script must be run as the root or rabbitmq user")
for line in output.split("\n"):
line = line.strip()

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import time
import datetime
@ -99,7 +100,7 @@ def send_reminders():
key = (uid, start)
if key not in sent:
line = '%s starts at %s' % (title, start.strftime('%H:%M'))
print 'Sending reminder:', line
print('Sending reminder:', line)
messages.append(line)
keys.add(key)

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python2.7
from __future__ import print_function
import subprocess
import os
import sys
@ -62,7 +63,7 @@ def process_logs():
file_data = last_data.get(log_file, {})
if not os.path.exists(log_file):
# If the file doesn't exist, log an error and then move on to the next file
print "Log file does not exist or could not stat log file: %s" % (log_file,)
print("Log file does not exist or could not stat log file: %s" % (log_file,))
continue
length = int(subprocess.check_output(["wc", "-l", log_file]).split()[0])
if file_data.get("last") is None:
@ -82,7 +83,7 @@ def process_logs():
if __name__ == "__main__":
if os.path.exists(lock_path):
print "Log2zulip lock held; not doing anything"
print("Log2zulip lock held; not doing anything")
sys.exit(0)
try:
@ -91,7 +92,7 @@ if __name__ == "__main__":
try:
log_files = ujson.loads(file(control_path, "r").read())
except Exception:
print "Could not load control data from %s" % (control_path,)
print("Could not load control data from %s" % (control_path,))
traceback.print_exc()
sys.exit(1)
process_logs()