mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Who knows why I wrote that without a for loop before?
This commit is contained in:
parent
487fb3cc2f
commit
ff370e29cf
@ -224,27 +224,24 @@ def separateModes(args):
|
|||||||
assert modes[0] in '+-', 'Invalid args: %r' % args
|
assert modes[0] in '+-', 'Invalid args: %r' % args
|
||||||
args = list(args[1:])
|
args = list(args[1:])
|
||||||
ret = []
|
ret = []
|
||||||
index = 0
|
|
||||||
length = len(modes)
|
length = len(modes)
|
||||||
while index < length:
|
for c in modes:
|
||||||
if modes[index] in '+-':
|
if c in '+-':
|
||||||
last = modes[index]
|
last = c
|
||||||
index += 1
|
|
||||||
else:
|
else:
|
||||||
if last == '+':
|
if last == '+':
|
||||||
requireArguments = _plusRequireArguments
|
requireArguments = _plusRequireArguments
|
||||||
else:
|
else:
|
||||||
requireArguments = _minusRequireArguments
|
requireArguments = _minusRequireArguments
|
||||||
if modes[index] in requireArguments:
|
if c in requireArguments:
|
||||||
arg = args.pop(0)
|
arg = args.pop(0)
|
||||||
try:
|
try:
|
||||||
arg = int(arg)
|
arg = int(arg)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
ret.append((last + modes[index], arg))
|
ret.append((last + c, arg))
|
||||||
else:
|
else:
|
||||||
ret.append((last + modes[index], None))
|
ret.append((last + c, None))
|
||||||
index += 1
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def joinModes(modes):
|
def joinModes(modes):
|
||||||
|
Loading…
Reference in New Issue
Block a user