def _parse_opt(argv):
    ops = []
    if ((len(argv) >= 2) and (argv[1][:1] in ('+', '-'))):
        opts = argv.pop(1)
        enable_refill = None
        for (i, c) in enumerate(opts):
            if (c == '+'):
                enable_refill = True
            elif (c == '-'):
                enable_refill = False
            elif ((c == 'r') and (enable_refill is not None)):

                def op(helper):
                    helper.use_refill = enable_refill
                    helper.refill_with_item = enable_refill
                ops.append(op)
            elif ((c == 'R') and (enable_refill is not None)):

                def op(helper):
                    helper.refill_with_originium = enable_refill
                ops.append(op)
            elif ((c in '0123456789') and enable_refill):
                num = int(opts[i:])

                def op(helper):
                    helper.max_refill_count = num
                ops.append(op)
                break
            else:
                raise ValueError(('unrecognized token: %r in option %r' % (c, opts)))
    return ops
def _parse_opt(argv):
    ops = []
    if ((len(argv) >= 2) and (argv[1][:1] in ('+', '-'))):
        opts = argv.pop(1)
        enable_refill = None
        for (i, c) in enumerate(opts):
            if (c == '+'):
                enable_refill = True
            elif (c == '-'):
                enable_refill = False
            elif ((c == 'r') and (enable_refill is not None)):

                def op(helper):
                    helper.use_refill = enable_refill
                    helper.refill_with_item = enable_refill
                ops.append(op)
            elif ((c == 'R') and (enable_refill is not None)):

                def op(helper):
                    helper.refill_with_originium = enable_refill
                ops.append(op)
            elif ((c in '0123456789') and enable_refill):
                num = int(opts[i:])

                def op(helper):
                    helper.max_refill_count = num
                ops.append(op)
                break
            else:
                raise ValueError(('unrecognized token: %r in option %r' % (c, opts)))
    return ops