mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-27 07:00:42 +00:00
Merge pull request #365 from elfring/Increase_the_usage_of_augmented_assignment_statements
Convert 14 statements to the usage of augmented assignments
This commit is contained in:
commit
b4912e7b64
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user