Kaydet (Commit) 9c2c1e88 authored tarafından Guido van Rossum's avatar Guido van Rossum

Fix multi-arg list.append() calls.

üst 215193bd
...@@ -126,7 +126,7 @@ def analyze_node(text): ...@@ -126,7 +126,7 @@ def analyze_node(text):
topic, ref = text[a1:b1], text[a2:b2] topic, ref = text[a1:b1], text[a2:b2]
if ref == ':': if ref == ':':
ref = topic ref = topic
menu.append(topic, ref) menu.append((topic, ref))
# #
# Get the footnotes # Get the footnotes
# #
...@@ -140,7 +140,7 @@ def analyze_node(text): ...@@ -140,7 +140,7 @@ def analyze_node(text):
topic, ref = text[a1:b1], text[a2:b2] topic, ref = text[a1:b1], text[a2:b2]
if ref == ':': if ref == ':':
ref = topic ref = topic
footnotes.append(topic, ref) footnotes.append((topic, ref))
# #
return node, (prev, next, up), menu, footnotes return node, (prev, next, up), menu, footnotes
# #
......
...@@ -94,7 +94,7 @@ def parse_indirlist(buf): ...@@ -94,7 +94,7 @@ def parse_indirlist(buf):
(a,b), (a1,b1), (a2,b2) = match (a,b), (a1,b1), (a2,b2) = match
file = buf[a1:b1] file = buf[a1:b1]
offset = eval(buf[a2:b2]) # XXX What if this gets overflow? offset = eval(buf[a2:b2]) # XXX What if this gets overflow?
list.append(file, offset) list.append((file, offset))
i = b i = b
return list return list
......
...@@ -168,7 +168,7 @@ class NFSClient(UDPClient): ...@@ -168,7 +168,7 @@ class NFSClient(UDPClient):
entries, eof = rest entries, eof = rest
last_cookie = None last_cookie = None
for fileid, name, cookie in entries: for fileid, name, cookie in entries:
list.append(fileid, name) list.append((fileid, name))
last_cookie = cookie last_cookie = cookie
if eof or last_cookie == None: if eof or last_cookie == None:
break break
......
...@@ -348,7 +348,7 @@ def makesublist(first, icolor): ...@@ -348,7 +348,7 @@ def makesublist(first, icolor):
for i in range(Gl.nparts): for i in range(Gl.nparts):
angle = (a + i*alpha + FULLC) % FULLC angle = (a + i*alpha + FULLC) % FULLC
value = 255*(Gl.nparts-1-i)/(Gl.nparts-1) value = 255*(Gl.nparts-1-i)/(Gl.nparts-1)
list.append(angle, icolor, value) list.append((angle, icolor, value))
list.sort() list.sort()
a, icolor, value = list[0] a, icolor, value = list[0]
if a <> 0: if a <> 0:
...@@ -416,7 +416,7 @@ def render(list, (little_hand, big_hand, seconds_hand)): ...@@ -416,7 +416,7 @@ def render(list, (little_hand, big_hand, seconds_hand)):
Gl.c3i((255, 255, 255)) # White Gl.c3i((255, 255, 255)) # White
circf(0.0, 0.0, 1.0) circf(0.0, 0.0, 1.0)
else: else:
list.append(3600, 0, 255) # Sentinel list.append((3600, 0, 255)) # Sentinel
# #
rgb = [255, 255, 255] rgb = [255, 255, 255]
a_prev = 0 a_prev = 0
......
...@@ -590,7 +590,7 @@ class Displayer(VideoParams): ...@@ -590,7 +590,7 @@ class Displayer(VideoParams):
r, g, b = int(rv*255.0), \ r, g, b = int(rv*255.0), \
int(gv*255.0), \ int(gv*255.0), \
int(bv*255.0) int(bv*255.0)
map.append(index, r, g, b) map.append((index, r, g, b))
if self.color0 == None: if self.color0 == None:
self.color0 = \ self.color0 = \
index, r, g, b index, r, g, b
...@@ -1034,7 +1034,7 @@ class RandomVinFile(BasicVinFile): ...@@ -1034,7 +1034,7 @@ class RandomVinFile(BasicVinFile):
rv = BasicVinFile.getnextframeheader(self) rv = BasicVinFile.getnextframeheader(self)
if self.canseek: if self.canseek:
pos = self.fp.tell() pos = self.fp.tell()
self.index.append(rv, pos) self.index.append((rv, pos))
return rv return rv
def getrandomframe(self, i): def getrandomframe(self, i):
......
...@@ -489,7 +489,7 @@ def imove(win, ref): ...@@ -489,7 +489,7 @@ def imove(win, ref):
# #
if win.file and win.node: if win.file and win.node:
lastnode = '(' + win.file + ')' + win.node lastnode = '(' + win.file + ')' + win.node
win.last.append(lastnode, win.textobj.getfocus()) win.last.append((lastnode, win.textobj.getfocus()))
win.file = file win.file = file
win.node = node win.node = node
win.header = header win.header = header
......
...@@ -126,7 +126,7 @@ def analyze_node(text): ...@@ -126,7 +126,7 @@ def analyze_node(text):
topic, ref = text[a1:b1], text[a2:b2] topic, ref = text[a1:b1], text[a2:b2]
if ref == ':': if ref == ':':
ref = topic ref = topic
menu.append(topic, ref) menu.append((topic, ref))
# #
# Get the footnotes # Get the footnotes
# #
...@@ -140,7 +140,7 @@ def analyze_node(text): ...@@ -140,7 +140,7 @@ def analyze_node(text):
topic, ref = text[a1:b1], text[a2:b2] topic, ref = text[a1:b1], text[a2:b2]
if ref == ':': if ref == ':':
ref = topic ref = topic
footnotes.append(topic, ref) footnotes.append((topic, ref))
# #
return node, (prev, next, up), menu, footnotes return node, (prev, next, up), menu, footnotes
# #
......
...@@ -94,7 +94,7 @@ def parse_indirlist(buf): ...@@ -94,7 +94,7 @@ def parse_indirlist(buf):
(a,b), (a1,b1), (a2,b2) = match (a,b), (a1,b1), (a2,b2) = match
file = buf[a1:b1] file = buf[a1:b1]
offset = eval(buf[a2:b2]) # XXX What if this gets overflow? offset = eval(buf[a2:b2]) # XXX What if this gets overflow?
list.append(file, offset) list.append((file, offset))
i = b i = b
return list return list
......
...@@ -95,7 +95,7 @@ def diffdata(a, b, flags): # Compute directory differences. ...@@ -95,7 +95,7 @@ def diffdata(a, b, flags): # Compute directory differences.
if x in ['./', '../']: if x in ['./', '../']:
pass pass
elif x not in b_list: elif x not in b_list:
a_only.append(x, a_only_action) a_only.append((x, a_only_action))
else: else:
ax = os.path.join(a, x) ax = os.path.join(a, x)
bx = os.path.join(b, x) bx = os.path.join(b, x)
...@@ -110,15 +110,15 @@ def diffdata(a, b, flags): # Compute directory differences. ...@@ -110,15 +110,15 @@ def diffdata(a, b, flags): # Compute directory differences.
except (RuntimeError, os.error): except (RuntimeError, os.error):
same = 0 same = 0
if same: if same:
ab_same.append(x, ab_same_action) ab_same.append((x, ab_same_action))
else: else:
ab_diff.append(x, ab_diff_action) ab_diff.append((x, ab_diff_action))
# #
for x in b_list: for x in b_list:
if x in ['./', '../']: if x in ['./', '../']:
pass pass
elif x not in a_list: elif x not in a_list:
b_only.append(x, b_only_action) b_only.append((x, b_only_action))
# #
return data return data
......
...@@ -113,7 +113,7 @@ class Dialog: ...@@ -113,7 +113,7 @@ class Dialog:
self.choices = {} self.choices = {}
list = [] list = []
for k, dc in self.options.items(): for k, dc in self.options.items():
list.append(k, dc) list.append((k, dc))
list.sort() list.sort()
for k, (d, c) in list: for k, (d, c) in list:
try: try:
......
...@@ -67,7 +67,7 @@ class Para: ...@@ -67,7 +67,7 @@ class Para:
self.words[i] = fo, te, wi, sp, 0, as, de self.words[i] = fo, te, wi, sp, 0, as, de
total = total + wi + sp total = total + wi + sp
if total < tab: if total < tab:
self.words.append(None, '', 0, tab-total, 0, as, de) self.words.append((None, '', 0, tab-total, 0, as, de))
# #
# Make a hanging tag: tab to hang, increment indent_left by hang, # Make a hanging tag: tab to hang, increment indent_left by hang,
# and reset indent_hang to -hang # and reset indent_hang to -hang
......
...@@ -40,7 +40,7 @@ def treat_file(file, outfp): ...@@ -40,7 +40,7 @@ def treat_file(file, outfp):
name = line[a2:b2] name = line[a2:b2]
pat = line[a:b] pat = line[a:b]
tag = pat + '\177' + `lineno` + ',' + `charno` + '\n' tag = pat + '\177' + `lineno` + ',' + `charno` + '\n'
tags.append(name, tag) tags.append((name, tag))
size = size + len(tag) size = size + len(tag)
charno = charno + len(line) charno = charno + len(line)
outfp.write('\f\n' + file + ',' + `size` + '\n') outfp.write('\f\n' + file + ',' + `size` + '\n')
......
...@@ -79,16 +79,16 @@ def process(fpi, fpo): ...@@ -79,16 +79,16 @@ def process(fpi, fpo):
ko = 0 ko = 0
word = words[1] word = words[1]
if word in defs: if word in defs:
stack.append(ok, ko, word) stack.append((ok, ko, word))
if not ko: ok = 0 if not ko: ok = 0
elif word in undefs: elif word in undefs:
stack.append(ok, not ko, word) stack.append((ok, not ko, word))
if ko: ok = 0 if ko: ok = 0
else: else:
stack.append(ok, -1, word) stack.append((ok, -1, word))
if ok: fpo.write(line) if ok: fpo.write(line)
elif keyword == 'if': elif keyword == 'if':
stack.append(ok, -1, '') stack.append((ok, -1, ''))
if ok: fpo.write(line) if ok: fpo.write(line)
elif keyword == 'else' and stack: elif keyword == 'else' and stack:
s_ok, s_ko, s_word = stack[-1] s_ok, s_ko, s_word = stack[-1]
......
...@@ -644,7 +644,7 @@ class TexinfoParser: ...@@ -644,7 +644,7 @@ class TexinfoParser:
def close_footnote(self): def close_footnote(self):
id = len(self.footnotes) + 1 id = len(self.footnotes) + 1
self.footnotes.append(id, self.collectsavings()) self.footnotes.append((id, self.collectsavings()))
def writefootnotes(self): def writefootnotes(self):
self.write(self.FN_HEADER) self.write(self.FN_HEADER)
...@@ -993,7 +993,7 @@ class TexinfoParser: ...@@ -993,7 +993,7 @@ class TexinfoParser:
for i in self.numbering: for i in self.numbering:
x = x + `i` + '.' x = x + `i` + '.'
args = x + ' ' + args args = x + ' ' + args
self.contents.append(level, args, self.nodename) self.contents.append((level, args, self.nodename))
self.write('<', type, '>') self.write('<', type, '>')
self.expand(args) self.expand(args)
self.write('</', type, '>\n') self.write('</', type, '>\n')
...@@ -1362,7 +1362,7 @@ class TexinfoParser: ...@@ -1362,7 +1362,7 @@ class TexinfoParser:
def do_vindex(self, args): self.index('vr', args) def do_vindex(self, args): self.index('vr', args)
def index(self, name, args): def index(self, name, args):
self.whichindex[name].append(args, self.nodename) self.whichindex[name].append((args, self.nodename))
def do_synindex(self, args): def do_synindex(self, args):
words = string.split(args) words = string.split(args)
...@@ -1409,7 +1409,7 @@ class TexinfoParser: ...@@ -1409,7 +1409,7 @@ class TexinfoParser:
break break
i = mo.end() i = mo.end()
sortkey = sortkey[i:] sortkey = sortkey[i:]
index1.append(sortkey, key, node) index1.append((sortkey, key, node))
del index[:] del index[:]
index1.sort() index1.sort()
self.write('<DL COMPACT>\n') self.write('<DL COMPACT>\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment