You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Issue #363: Convert 14 statements to the usage of augmented assignments
Augmented assignment statements became available with Python 2. https://docs.python.org/3/whatsnew/2.0.html#augmented-assignment Thus adjust 14 source code places accordingly. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
This commit is contained in:
@@ -14,11 +14,11 @@ def a():
|
||||
def c():
|
||||
k = 34
|
||||
global i
|
||||
i = i+k
|
||||
i += k
|
||||
l = 42
|
||||
c()
|
||||
global j
|
||||
j = j+l
|
||||
j += l
|
||||
b()
|
||||
print i, j # should print 35, 49
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
def f():
|
||||
print x # would result in a 'NameError' or 'UnboundLocalError'
|
||||
x = x+1
|
||||
x += 1
|
||||
print x
|
||||
|
||||
raise "This program can't be run"
|
||||
|
@@ -28,7 +28,7 @@ else:
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i+1
|
||||
i += 1
|
||||
if i == 3:
|
||||
continue
|
||||
if i == 5:
|
||||
@@ -40,7 +40,7 @@ print
|
||||
|
||||
i = 0
|
||||
while i < 10:
|
||||
i = i+1
|
||||
i += 1
|
||||
if i == 3:
|
||||
continue
|
||||
print i,
|
||||
|
@@ -55,9 +55,9 @@ class DBRecIO:
|
||||
if self.closed:
|
||||
raise ValueError, "I/O operation on closed file"
|
||||
if mode == 1:
|
||||
pos = pos + self.pos
|
||||
pos += self.pos
|
||||
elif mode == 2:
|
||||
pos = pos + self.len
|
||||
pos += self.len
|
||||
self.pos = max(0, pos)
|
||||
|
||||
def tell(self):
|
||||
@@ -84,7 +84,7 @@ class DBRecIO:
|
||||
if self.closed:
|
||||
raise ValueError, "I/O operation on closed file"
|
||||
if self.buflist:
|
||||
self.buf = self.buf + string.joinfields(self.buflist, '')
|
||||
self.buf += string.joinfields(self.buflist, '')
|
||||
self.buflist = []
|
||||
i = string.find(self.buf, '\n', self.pos)
|
||||
if i < 0:
|
||||
|
@@ -3,7 +3,7 @@ def flatten(tup):
|
||||
elts = []
|
||||
for elt in tup:
|
||||
if isinstance(elt, tuple):
|
||||
elts = elts + flatten(elt)
|
||||
elts += flatten(elt)
|
||||
else:
|
||||
elts.append(elt)
|
||||
return elts
|
||||
@@ -53,7 +53,7 @@ def mangle(name, klass):
|
||||
try:
|
||||
i = 0
|
||||
while klass[i] == '_':
|
||||
i = i + 1
|
||||
i += 1
|
||||
except IndexError:
|
||||
return name
|
||||
klass = klass[i:]
|
||||
|
@@ -30,7 +30,7 @@ class SyntaxErrorChecker:
|
||||
self.errors = 0
|
||||
|
||||
def error(self, node, msg):
|
||||
self.errors = self.errors + 1
|
||||
self.errors += 1
|
||||
if self.multi is not None:
|
||||
print "%s:%s: %s" % (node.filename, node.lineno, msg)
|
||||
else:
|
||||
|
@@ -9,11 +9,11 @@ def normpath(comps):
|
||||
del comps[i]
|
||||
elif comps[i] == '..' and i > 0 and comps[i-1] not in ('', '..'):
|
||||
del comps[i-1:i+1]
|
||||
i = i - 1
|
||||
i -= 1
|
||||
elif comps[i] == '' and i > 0 and comps[i-1] != '':
|
||||
del comps[i]
|
||||
else:
|
||||
i = i + 1
|
||||
i += 1
|
||||
return comps
|
||||
|
||||
assert normpath(['.']) == []
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# messing up control flow detection
|
||||
def _format_usage(self, usage, actions, groups, prefix):
|
||||
if usage:
|
||||
usage = usage % dict(prog=self._prog)
|
||||
usage %= dict(prog=self._prog)
|
||||
|
||||
elif usage is None:
|
||||
prog = 5
|
||||
|
Reference in New Issue
Block a user