Skip to content

Commit

Permalink
Merge pull request #112 from a-detiste/master
Browse files Browse the repository at this point in the history
remove leftover python2 "print"s
  • Loading branch information
meejah authored Sep 20, 2024
2 parents c93d980 + ff1e0da commit b7c46c9
Show file tree
Hide file tree
Showing 40 changed files with 19 additions and 53 deletions.
6 changes: 3 additions & 3 deletions doc/listings/copyable-receive.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def setCopyableState(self, d):
self.shoe_size = "they wouldn't tell us"

def display(self):
print "Name:", self.name
print "Age:", self.age
print "Shoe Size:", self.shoe_size
print("Name:", self.name)
print("Age:", self.age)
print("Shoe Size:", self.shoe_size)

def getRecord(rref, name):
d = rref.callRemote("getuser", name=name)
Expand Down
2 changes: 1 addition & 1 deletion doc/listings/copyable-send.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def remote_getuser(self, name):
tub.listenOn("tcp:12345")
tub.setLocation("localhost:12345")
url = tub.registerReference(db, "database")
print "the database is at:", url
print("the database is at:", url)
tub.startService()
reactor.run()
12 changes: 6 additions & 6 deletions doc/listings/pb2client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
from foolscap.api import Tub

def gotError1(why):
print "unable to get the RemoteReference:", why
print("unable to get the RemoteReference:", why)
reactor.stop()

def gotError2(why):
print "unable to invoke the remote method:", why
print("unable to invoke the remote method:", why)
reactor.stop()

def gotReference(remote):
print "got a RemoteReference"
print "asking it to add 1+2"
print("got a RemoteReference")
print("asking it to add 1+2")
d = remote.callRemote("add", a=1, b=2)
d.addCallbacks(gotAnswer, gotError2)

def gotAnswer(answer):
print "the answer is", answer
print("the answer is", answer)
reactor.stop()

if len(sys.argv) < 2:
print "Usage: pb2client.py URL"
print("Usage: pb2client.py URL")
sys.exit(1)
url = sys.argv[1]
tub = Tub()
Expand Down
2 changes: 1 addition & 1 deletion doc/listings/pb2server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def remote_subtract(self, a, b):
tub.listenOn("tcp:12345")
tub.setLocation("localhost:12345")
url = tub.registerReference(myserver, "math-service")
print "the object is available at:", url
print("the object is available at:", url)

tub.startService()
reactor.run()
2 changes: 1 addition & 1 deletion doc/listings/pb3calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def remote_pop(self):
tub.listenOn("tcp:12345")
tub.setLocation("localhost:12345")
url = tub.registerReference(Calculator(), "calculator")
print "the object is available at:", url
print("the object is available at:", url)

application = service.Application("pb2calculator")
tub.setServiceParent(application)
Expand Down
6 changes: 3 additions & 3 deletions doc/listings/pb3user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

class Observer(Referenceable):
def remote_event(self, msg):
print "event:", msg
print("event:", msg)

def printResult(number):
print "the result is", number
print("the result is", number)
def gotError(err):
print "got an error:", err
print("got an error:", err)
def gotRemote(remote):
o = Observer()
d = remote.callRemote("addObserver", observer=o)
Expand Down
8 changes: 4 additions & 4 deletions misc/run-deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def run_command(main):
pw = os.environ.get("PYTHONWARNINGS")
DDW = "default::DeprecationWarning"
if pw != DDW:
print "note: $PYTHONWARNINGS is '%s', not the expected %s" % (pw, DDW)
print("note: $PYTHONWARNINGS is '%s', not the expected %s" % (pw, DDW))
sys.stdout.flush()

pp = RunPP()
Expand Down Expand Up @@ -84,11 +84,11 @@ def add(line):
if warnings:
if config["warnings"]:
with open(config["warnings"], "wb") as f:
print >>f, "".join(warnings)
print "ERROR: %d deprecation warnings found" % len(warnings)
print("".join(warnings), flush=True)
print("ERROR: %d deprecation warnings found" % len(warnings))
sys.exit(1)

print "no deprecation warnings"
print("no deprecation warnings")
if signal:
sys.exit(signal)
sys.exit(rc)
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/appserver/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import six, os, sys, shutil, errno, time, signal
from io import StringIO
from twisted.python import usage
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/appserver/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import six
import os, sys
from io import BytesIO
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/appserver/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import os, sys, json, ast
import six
from twisted.application import service
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/appserver/services.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import unicode_literals
import os
import six
from twisted.python import usage, runtime, filepath, log
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/banana.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import six
import struct, time

Expand Down
1 change: 0 additions & 1 deletion src/foolscap/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# This module is responsible for the per-connection Broker object

from __future__ import print_function
import six
import types, time
from itertools import count
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import sys
from io import StringIO
from twisted.python import usage
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/dumper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import six, sys, errno, textwrap
from twisted.python import usage
from foolscap.logging import flogfile
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import six
from twisted.python import usage
import sys, os, bz2, time
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/gatherer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import six, os, sys, time, bz2
signal = None
try:
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/incident.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import six
import sys, os.path, time, bz2
import json
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/log.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import os, sys, time, weakref, binascii
import traceback
import collections
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/publish.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import os
from collections import deque
import six
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/tail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function, unicode_literals
import six, os, sys, time
from zope.interface import implementer
from twisted.internet import reactor
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/logging/web.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import time
import six
from six.moves.urllib.parse import quote
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/negotiate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_negotiate -*-

from __future__ import print_function
import time
import six
from twisted.python.failure import Failure
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/referenceable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Referenceable (callable) objects. All details of actually invoking methods
# live in call.py

from __future__ import print_function
import weakref
from functools import total_ordering
import six
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/slicers/list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_banana -*-

from __future__ import print_function
from twisted.python import log
from twisted.internet.defer import Deferred
from foolscap.tokens import Violation
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/slicers/root.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_banana -*-

from __future__ import print_function
import six
from zope.interface import implementer
from twisted.internet.defer import Deferred
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/slicers/set.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_banana -*-

from __future__ import print_function
from twisted.internet import defer
from twisted.python import log
from foolscap.slicers.list import ListSlicer
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/slicers/tuple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_banana -*-

from __future__ import print_function
from twisted.internet.defer import Deferred
from foolscap.tokens import Violation
from foolscap.slicer import BaseUnslicer
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/apphelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
script lets the test work on windows too.
"""

from __future__ import unicode_literals
import sys, os.path
import six

Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/bench_banana.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import io
from foolscap import storage

Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/check-connections-client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#! /usr/bin/python
from __future__ import print_function

# This is the client side of a manual test for the socks/tor
# connection-handler code. To use it, first set up the server as described in
Expand Down
2 changes: 0 additions & 2 deletions src/foolscap/test/check-connections-server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#! /usr/bin/python

from __future__ import print_function

# This is the server side of a manual test for the socks/tor
# connection-handler code. On the server host, configure Tor to route a
# hidden service to our port with something like:
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_pb -*-

from __future__ import print_function
import six
import time
from zope.interface import implementer, implementer_only, implementedBy, Interface
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test__versions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
from twisted.trial import unittest
import time
import platform
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_banana.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import six
import os
import os.path
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_copyable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import six
from twisted.trial import unittest
from twisted.python import components, failure, reflect
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_gifts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
from zope.interface import implementer
from twisted.trial import unittest
from twisted.internet import defer, protocol, reactor
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_interfaces -*-

from __future__ import print_function
from zope.interface import implementer_only
from twisted.trial import unittest

Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_pb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_pb -*-

from __future__ import print_function
import re

if False:
Expand Down
1 change: 0 additions & 1 deletion src/foolscap/test/test_tub.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- test-case-name: foolscap.test.test_tub -*-

from __future__ import print_function
import os.path
import os
from twisted.trial import unittest
Expand Down

0 comments on commit b7c46c9

Please sign in to comment.