summaryrefslogtreecommitdiffstats
path: root/Demo/threads
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2004-02-12 17:35:32 (GMT)
commit70a6b49821a3226f55e9716f32d802d06640cb89 (patch)
tree3c8ca10c1fa09e025bd266cf855a00d7d96c55aa /Demo/threads
parentecfeb7f095dfd9c1c8929bf3df858ee35e0d9e9e (diff)
downloadcpython-70a6b49821a3226f55e9716f32d802d06640cb89.zip
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.gz
cpython-70a6b49821a3226f55e9716f32d802d06640cb89.tar.bz2
Replace backticks with repr() or "%r"
From SF patch #852334.
Diffstat (limited to 'Demo/threads')
-rw-r--r--Demo/threads/Coroutine.py7
-rw-r--r--Demo/threads/find.py6
-rw-r--r--Demo/threads/sync.py4
-rw-r--r--Demo/threads/telnet.py8
4 files changed, 12 insertions, 13 deletions
diff --git a/Demo/threads/Coroutine.py b/Demo/threads/Coroutine.py
index 0cf9255..4cc65f7 100644
--- a/Demo/threads/Coroutine.py
+++ b/Demo/threads/Coroutine.py
@@ -138,10 +138,9 @@ class Coroutine:
def tran(self, target, data=None):
if not self.invokedby.has_key(target):
- raise TypeError, '.tran target ' + `target` + \
- ' is not an active coroutine'
+ raise TypeError, '.tran target %r is not an active coroutine' % (target,)
if self.killed:
- raise TypeError, '.tran target ' + `target` + ' is killed'
+ raise TypeError, '.tran target %r is killed' % (target,)
self.value = data
me = self.active
self.invokedby[target] = me
@@ -153,7 +152,7 @@ class Coroutine:
if self.main is not me:
raise Killed
if self.terminated_by is not None:
- raise EarlyExit, `self.terminated_by` + ' terminated early'
+ raise EarlyExit, '%r terminated early' % (self.terminated_by,)
return self.value
diff --git a/Demo/threads/find.py b/Demo/threads/find.py
index ab581e3..7d5edc1 100644
--- a/Demo/threads/find.py
+++ b/Demo/threads/find.py
@@ -116,7 +116,7 @@ def main():
wq.run(nworkers)
t2 = time.time()
- sys.stderr.write('Total time ' + `t2-t1` + ' sec.\n')
+ sys.stderr.write('Total time %r sec.\n' % (t2-t1))
# The predicate -- defines what files we look for.
@@ -133,7 +133,7 @@ def find(dir, pred, wq):
try:
names = os.listdir(dir)
except os.error, msg:
- print `dir`, ':', msg
+ print repr(dir), ':', msg
return
for name in names:
if name not in (os.curdir, os.pardir):
@@ -141,7 +141,7 @@ def find(dir, pred, wq):
try:
stat = os.lstat(fullname)
except os.error, msg:
- print `fullname`, ':', msg
+ print repr(fullname), ':', msg
continue
if pred(dir, name, fullname, stat):
print fullname
diff --git a/Demo/threads/sync.py b/Demo/threads/sync.py
index a8556c4..1688403 100644
--- a/Demo/threads/sync.py
+++ b/Demo/threads/sync.py
@@ -336,7 +336,7 @@ class condition:
def broadcast(self, num = -1):
if num < -1:
- raise ValueError, '.broadcast called with num ' + `num`
+ raise ValueError, '.broadcast called with num %r' % (num,)
if num == 0:
return
self.idlock.acquire()
@@ -418,7 +418,7 @@ class semaphore:
self.nonzero.acquire()
if self.count == self.maxcount:
raise ValueError, '.v() tried to raise semaphore count above ' \
- 'initial value ' + `maxcount`
+ 'initial value %r' % (maxcount,))
self.count = self.count + 1
self.nonzero.signal()
self.nonzero.release()
diff --git a/Demo/threads/telnet.py b/Demo/threads/telnet.py
index 3c70cb0..707a353 100644
--- a/Demo/threads/telnet.py
+++ b/Demo/threads/telnet.py
@@ -57,7 +57,7 @@ def main():
try:
s.connect((host, port))
except error, msg:
- sys.stderr.write('connect failed: ' + `msg` + '\n')
+ sys.stderr.write('connect failed: %r\n' % (msg,))
sys.exit(1)
#
thread.start_new(child, (s,))
@@ -77,7 +77,7 @@ def parent(s):
for c in data:
if opt:
print ord(c)
-## print '(replying: ' + `opt+c` + ')'
+## print '(replying: %r)' % (opt+c,)
s.send(opt + c)
opt = ''
elif iac:
@@ -101,13 +101,13 @@ def parent(s):
cleandata = cleandata + c
sys.stdout.write(cleandata)
sys.stdout.flush()
-## print 'Out:', `cleandata`
+## print 'Out:', repr(cleandata)
def child(s):
# read stdin, write socket
while 1:
line = sys.stdin.readline()
-## print 'Got:', `line`
+## print 'Got:', repr(line)
if not line: break
s.send(line)