Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import.
This commit is contained in:
parent
27981480a2
commit
328816a329
8 changed files with 165 additions and 157 deletions
|
@ -6,6 +6,7 @@
|
|||
# Setup: First, you need to install python-irc version 8.5.3
|
||||
# (https://bitbucket.org/jaraco/irc)
|
||||
|
||||
from __future__ import print_function
|
||||
import irc.bot
|
||||
import irc.strings
|
||||
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr
|
||||
|
@ -53,12 +54,12 @@ class IRCBot(irc.bot.SingleServerIRCBot):
|
|||
return
|
||||
|
||||
# Forward the PM to Zulip
|
||||
print zulip_client.send_message({
|
||||
print(zulip_client.send_message({
|
||||
"sender": sender,
|
||||
"type": "private",
|
||||
"to": "username@example.com",
|
||||
"content": content,
|
||||
})
|
||||
}))
|
||||
|
||||
def on_pubmsg(self, c, e):
|
||||
content = e.arguments[0]
|
||||
|
@ -68,14 +69,14 @@ class IRCBot(irc.bot.SingleServerIRCBot):
|
|||
return
|
||||
|
||||
# Forward the stream message to Zulip
|
||||
print zulip_client.send_message({
|
||||
print(zulip_client.send_message({
|
||||
"forged": "yes",
|
||||
"sender": sender,
|
||||
"type": "stream",
|
||||
"to": stream,
|
||||
"subject": "IRC",
|
||||
"content": content,
|
||||
})
|
||||
}))
|
||||
|
||||
def on_dccmsg(self, c, e):
|
||||
c.privmsg("You said: " + e.arguments[0])
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
|
@ -39,7 +40,7 @@ args.extend(sys.argv[1:])
|
|||
|
||||
backoff = RandomExponentialBackoff(timeout_success_equivalent=300)
|
||||
while backoff.keep_going():
|
||||
print "Starting Jabber mirroring bot"
|
||||
print("Starting Jabber mirroring bot")
|
||||
try:
|
||||
ret = subprocess.call(args)
|
||||
except:
|
||||
|
@ -51,9 +52,9 @@ while backoff.keep_going():
|
|||
|
||||
backoff.fail()
|
||||
|
||||
print ""
|
||||
print ""
|
||||
print "ERROR: The Jabber mirroring bot is unable to continue mirroring Jabber."
|
||||
print "Please contact zulip-devel@googlegroups.com if you need assistance."
|
||||
print ""
|
||||
print("")
|
||||
print("")
|
||||
print("ERROR: The Jabber mirroring bot is unable to continue mirroring Jabber.")
|
||||
print("Please contact zulip-devel@googlegroups.com if you need assistance.")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from __future__ import print_function
|
||||
# This is hacky code to analyze data on our support stream. The main
|
||||
# reusable bits are get_recent_messages and get_words.
|
||||
|
||||
|
@ -31,7 +32,7 @@ def analyze_messages(msgs, word_count, email_count):
|
|||
if False:
|
||||
if ' ack' in msg['content']:
|
||||
name = msg['sender_full_name'].split()[0]
|
||||
print 'ACK', name
|
||||
print('ACK', name)
|
||||
m = re.search('ticket (Z....).*email: (\S+).*~~~(.*)', msg['content'], re.M | re.S)
|
||||
if m:
|
||||
ticket, email, req = m.groups()
|
||||
|
@ -40,9 +41,9 @@ def analyze_messages(msgs, word_count, email_count):
|
|||
word_count[word] += 1
|
||||
email_count[email] += 1
|
||||
if False:
|
||||
print
|
||||
print()
|
||||
for k, v in msg.items():
|
||||
print '%-20s: %s' % (k, v)
|
||||
print('%-20s: %s' % (k, v))
|
||||
|
||||
def generate_support_stats():
|
||||
client = zulip.Client()
|
||||
|
@ -68,12 +69,12 @@ def generate_support_stats():
|
|||
words = filter(lambda w: len(w) >= 5, words)
|
||||
words = sorted(words, key=lambda w: word_count[w], reverse=True)
|
||||
for word in words:
|
||||
print word, word_count[word]
|
||||
print(word, word_count[word])
|
||||
|
||||
if False:
|
||||
emails = email_count.keys()
|
||||
emails = sorted(emails, key=lambda w: email_count[w], reverse=True)
|
||||
for email in emails:
|
||||
print email, email_count[email]
|
||||
print(email, email_count[email])
|
||||
|
||||
generate_support_stats()
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
# SOFTWARE.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
|
@ -53,30 +54,30 @@ if options.forward_class_messages and not options.noshard:
|
|||
if options.on_startup_command is not None:
|
||||
subprocess.call([options.on_startup_command])
|
||||
from zerver.lib.parallel import run_parallel
|
||||
print "Starting parallel zephyr class mirroring bot"
|
||||
print("Starting parallel zephyr class mirroring bot")
|
||||
jobs = list("0123456789abcdef")
|
||||
def run_job(shard):
|
||||
subprocess.call(args + ["--shard=%s" % (shard,)])
|
||||
return 0
|
||||
for (status, job) in run_parallel(run_job, jobs, threads=16):
|
||||
print "A mirroring shard died!"
|
||||
print("A mirroring shard died!")
|
||||
pass
|
||||
sys.exit(0)
|
||||
|
||||
backoff = RandomExponentialBackoff(timeout_success_equivalent=300)
|
||||
while backoff.keep_going():
|
||||
print "Starting zephyr mirroring bot"
|
||||
print("Starting zephyr mirroring bot")
|
||||
try:
|
||||
subprocess.call(args)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
backoff.fail()
|
||||
|
||||
print ""
|
||||
print ""
|
||||
print "ERROR: The Zephyr mirroring bot is unable to continue mirroring Zephyrs."
|
||||
print "This is often caused by failing to maintain unexpired Kerberos tickets"
|
||||
print "or AFS tokens. See https://zulip.com/zephyr for documentation on how to"
|
||||
print "maintain unexpired Kerberos tickets and AFS tokens."
|
||||
print ""
|
||||
print("")
|
||||
print("")
|
||||
print("ERROR: The Zephyr mirroring bot is unable to continue mirroring Zephyrs.")
|
||||
print("This is often caused by failing to maintain unexpired Kerberos tickets")
|
||||
print("or AFS tokens. See https://zulip.com/zephyr for documentation on how to")
|
||||
print("maintain unexpired Kerberos tickets and AFS tokens.")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue