summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
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/scripts
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/scripts')
-rwxr-xr-xDemo/scripts/eqfix.py19
-rwxr-xr-xDemo/scripts/from.py2
-rwxr-xr-xDemo/scripts/ftpstats.py2
-rwxr-xr-xDemo/scripts/lpwatch.py16
-rwxr-xr-xDemo/scripts/markov.py4
-rwxr-xr-xDemo/scripts/mboxconvert.py4
-rwxr-xr-xDemo/scripts/mkrcs.py20
-rwxr-xr-xDemo/scripts/mpzpi.py2
-rwxr-xr-xDemo/scripts/newslist.py2
-rwxr-xr-xDemo/scripts/pp.py2
10 files changed, 36 insertions, 37 deletions
diff --git a/Demo/scripts/eqfix.py b/Demo/scripts/eqfix.py
index 583d54e..2139d2b 100755
--- a/Demo/scripts/eqfix.py
+++ b/Demo/scripts/eqfix.py
@@ -58,12 +58,12 @@ def ispython(name):
return ispythonprog.match(name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
except os.error, msg:
- err(dirname + ': cannot list directory: ' + `msg` + '\n')
+ err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
subdirs = []
@@ -80,11 +80,11 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (dirname,))
try:
f = open(filename, 'r')
except IOError, msg:
- err(filename + ': cannot open: ' + `msg` + '\n')
+ err('%s: cannot open: %r\n' % (filename, msg))
return 1
head, tail = os.path.split(filename)
tempname = os.path.join(head, '@' + tail)
@@ -122,14 +122,13 @@ def fix(filename):
g = open(tempname, 'w')
except IOError, msg:
f.close()
- err(tempname+': cannot create: '+\
- `msg`+'\n')
+ err('%s: cannot create: %r\n' % (tempname, msg))
return 1
f.seek(0)
lineno = 0
rep(filename + ':\n')
continue # restart from the beginning
- rep(`lineno` + '\n')
+ rep(repr(lineno) + '\n')
rep('< ' + line)
rep('> ' + newline)
if g is not None:
@@ -146,17 +145,17 @@ def fix(filename):
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
except os.error, msg:
- err(tempname + ': warning: chmod failed (' + `msg` + ')\n')
+ err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
except os.error, msg:
- err(filename + ': warning: backup failed (' + `msg` + ')\n')
+ err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
except os.error, msg:
- err(filename + ': rename failed (' + `msg` + ')\n')
+ err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
return 0
diff --git a/Demo/scripts/from.py b/Demo/scripts/from.py
index d61afde..3c04fcd 100755
--- a/Demo/scripts/from.py
+++ b/Demo/scripts/from.py
@@ -31,5 +31,5 @@ while 1:
if not line or line == '\n':
break
if line.startswith('Subject: '):
- print `line[9:-1]`,
+ print repr(line[9:-1]),
print
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 28b1d8b..79cbee6 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -60,7 +60,7 @@ def main():
if search and string.find(line, search) < 0:
continue
if prog.match(line) < 0:
- print 'Bad line', lineno, ':', `line`
+ print 'Bad line', lineno, ':', repr(line)
continue
items = prog.group(1, 2, 3, 4, 5, 6)
(logtime, loguser, loghost, logfile, logbytes,
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 9f051eb..00afba9 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -83,24 +83,24 @@ def makestatus(name, thisuser):
lines.append(line)
#
if totaljobs:
- line = `(totalbytes+1023)/1024` + ' K'
+ line = '%d K' % ((totalbytes+1023)/1024)
if totaljobs <> len(users):
- line = line + ' (' + `totaljobs` + ' jobs)'
+ line = line + ' (%d jobs)' % totaljobs
if len(users) == 1:
- line = line + ' for ' + users.keys()[0]
+ line = line + ' for %s' % (users.keys()[0],)
else:
- line = line + ' for ' + `len(users)` + ' users'
+ line = line + ' for %d users' % len(users)
if userseen:
if aheadjobs == 0:
- line = line + ' (' + thisuser + ' first)'
+ line = line + ' (%s first)' % thisuser
else:
- line = line + ' (' + `(aheadbytes+1023)/1024`
- line = line + ' K before ' + thisuser + ')'
+ line = line + ' (%d K before %s)' % (
+ (aheadbytes+1023)/1024, thisuser)
lines.append(line)
#
sts = pipe.close()
if sts:
- lines.append('lpq exit status ' + `sts`)
+ lines.append('lpq exit status %r' % (sts,))
return string.joinfields(lines, ': ')
try:
diff --git a/Demo/scripts/markov.py b/Demo/scripts/markov.py
index e1649f1..b0583d1 100755
--- a/Demo/scripts/markov.py
+++ b/Demo/scripts/markov.py
@@ -89,8 +89,8 @@ def test():
if debug > 1:
for key in m.trans.keys():
if key is None or len(key) < histsize:
- print `key`, m.trans[key]
- if histsize == 0: print `''`, m.trans['']
+ print repr(key), m.trans[key]
+ if histsize == 0: print repr(''), m.trans['']
print
while 1:
data = m.get()
diff --git a/Demo/scripts/mboxconvert.py b/Demo/scripts/mboxconvert.py
index 08e0d0c..996537d 100755
--- a/Demo/scripts/mboxconvert.py
+++ b/Demo/scripts/mboxconvert.py
@@ -73,7 +73,7 @@ def mmdf(f):
sts = message(f, line) or sts
else:
sys.stderr.write(
- 'Bad line in MMFD mailbox: %s\n' % `line`)
+ 'Bad line in MMFD mailbox: %r\n' % (line,))
return sts
counter = 0 # for generating unique Message-ID headers
@@ -89,7 +89,7 @@ def message(f, delimiter = ''):
t = time.mktime(tt)
else:
sys.stderr.write(
- 'Unparseable date: %s\n' % `m.getheader('Date')`)
+ 'Unparseable date: %r\n' % (m.getheader('Date'),))
t = os.fstat(f.fileno())[stat.ST_MTIME]
print 'From', email, time.ctime(t)
# Copy RFC822 header
diff --git a/Demo/scripts/mkrcs.py b/Demo/scripts/mkrcs.py
index 36a35ea..917b4fe 100755
--- a/Demo/scripts/mkrcs.py
+++ b/Demo/scripts/mkrcs.py
@@ -12,13 +12,13 @@ def main():
rcstree = 'RCStree'
rcs = 'RCS'
if os.path.islink(rcs):
- print `rcs`, 'is a symlink to', `os.readlink(rcs)`
+ print '%r is a symlink to %r' % (rcs, os.readlink(rcs))
return
if os.path.isdir(rcs):
- print `rcs`, 'is an ordinary directory'
+ print '%r is an ordinary directory' % (rcs,)
return
if os.path.exists(rcs):
- print `rcs`, 'is a file?!?!'
+ print '%r is a file?!?!' % (rcs,)
return
#
p = os.getcwd()
@@ -29,26 +29,26 @@ def main():
# (2) up is the same directory as p
# Ergo:
# (3) join(up, down) is the current directory
- #print 'p =', `p`
+ #print 'p =', repr(p)
while not os.path.isdir(os.path.join(p, rcstree)):
head, tail = os.path.split(p)
- #print 'head =', `head`, '; tail =', `tail`
+ #print 'head = %r; tail = %r' % (head, tail)
if not tail:
- print 'Sorry, no ancestor dir contains', `rcstree`
+ print 'Sorry, no ancestor dir contains %r' % (rcstree,)
return
p = head
up = os.path.join(os.pardir, up)
down = os.path.join(tail, down)
- #print 'p =', `p`, '; up =', `up`, '; down =', `down`
+ #print 'p = %r; up = %r; down = %r' % (p, up, down)
there = os.path.join(up, rcstree)
there = os.path.join(there, down)
there = os.path.join(there, rcs)
if os.path.isdir(there):
- print `there`, 'already exists'
+ print '%r already exists' % (there, )
else:
- print 'making', `there`
+ print 'making %r' % (there,)
makedirs(there)
- print 'making symlink', `rcs`, '->', `there`
+ print 'making symlink %r -> %r' % (rcs, there)
os.symlink(there, rcs)
def makedirs(p):
diff --git a/Demo/scripts/mpzpi.py b/Demo/scripts/mpzpi.py
index 93c74aa..ccf591d 100755
--- a/Demo/scripts/mpzpi.py
+++ b/Demo/scripts/mpzpi.py
@@ -27,7 +27,7 @@ def main():
def output(d):
# Use write() to avoid spaces between the digits
# Use int(d) to avoid a trailing L after each digit
- sys.stdout.write(`int(d)`)
+ sys.stdout.write(repr(int(d)))
# Flush so the output is seen immediately
sys.stdout.flush()
diff --git a/Demo/scripts/newslist.py b/Demo/scripts/newslist.py
index f78ca30..b06b452 100755
--- a/Demo/scripts/newslist.py
+++ b/Demo/scripts/newslist.py
@@ -304,7 +304,7 @@ def getallgroups(server):
def getnewgroups(server, treedate):
print 'Getting list of new groups since start of '+treedate+'...',
info = server.newgroups(treedate,'000001')[1]
- print 'got '+`len(info)`+'.'
+ print 'got %d.' % len(info)
print 'Processing...',
groups = []
for i in info:
diff --git a/Demo/scripts/pp.py b/Demo/scripts/pp.py
index 64e57ee..92a1104 100755
--- a/Demo/scripts/pp.py
+++ b/Demo/scripts/pp.py
@@ -125,6 +125,6 @@ fp.write(program)
fp.flush()
if DFLAG:
import pdb
- pdb.run('execfile(' + `tfn` + ')')
+ pdb.run('execfile(%r)' % (tfn,))
else:
execfile(tfn)