Ejemplo n.º 1
0
def formatfunc(args):
    seqlst = []
    seq = seqmap.SequFuncs(args)
    low_re = re.compile("([a-z])")
    high_re = re.compile("([A-Z])")
    if args.formatwords == "arabic":
        for i in seq.sequ_ret():
            seqlst.append(i)
    elif args.formatwords == "floating":
        for i in seq.sequ_ret():
            seqlst.append(float(i))
    elif args.formatwords == "alpha":
        for i in seq.sequ_ret():
            if (0 < int(args.minimum) < 26) and (1 < int(args.maximum) < 27):
                for i in seq.sequ_ret():
                     seqlst.append(chr(int(i + 96)))
            else:
                print('Please use correct range for alpha (1 - 26)')
    elif args.formatwords == "ALPHA":
            if (0 < int(args.minimum) < 27) and (1 < int(args.maximum) < 27):
                for i in seq.sequ_ret():
                    seqlst.append(chr(int(i) + 64))
            else:
                print('Please use correct range for alpha (1 - 26)')
    elif args.formatwords == "roman":
        for i in seq.sequ_ret():
            seqlst.append(to_romanl(i))
    elif args.formatwords == "ROMAN":
        for i in seq.sequ_ret():
            seqlst.append(to_romanu(i))
        if type(args.minimum) == int:
            for i in seq.sequ_ret():
                seqlst.append(i)
        elif type(args.minimum) == float:
            for i in seq.sequ_ret():
                seqlst.append(float(i))
        elif rom_pat_up.search(args.minimum):
            for i in seq.sequ_ret():
                 seqlst.append(to_romanu(i))
        elif rom_pat_low.search(args.minimum):
            for i in seq.sequ_ret():
                seqlst.append(to_romanl(i))
        elif high_re.search(args.minimum):
            for i in seq.sequ_ret():
                seqlst.append(chr(int(i) + 64))
        elif low_re.search(args.minimum):
            for i in seq.sequ_ret():
                 seqlst.append(chr(int(i) + 96))
        else:
            for i in seq.sequ_ret():
                seqlst.append(i)
    else:
        for i in seq.sequ_ret():
            seqlst.append(i)
    return seqlst
Ejemplo n.º 2
0
def parsefunc(args):
    seqlst = []
    seq = seqmap.SequFuncs(args)
    low_re = re.compile("([a-z])")
    high_re = re.compile("([A-Z])")
    int_map = re.compile("([0-9])")

    if args.formatwords:
        if args.formatwords == "arabic":
            for i in seq.sequ_ret():
                seqlst.append(i)
        elif args.formatwords == "floating":
            for i in seq.sequ_ret():
                seqlst.append(float(i))
        elif args.formatwords == "alpha":
            for i in seq.sequ_ret():
                if (0 < int(args.minimum) < 26) and (1 < int(args.maximum) < 27):
                    for i in seq.sequ_ret():
                        seqlst.append(chr(int(i + 96)))
                else:
                    print('Please use correct range for alpha (1 - 26)')
        elif args.formatwords == "ALPHA":
                if (0 < int(args.minimum) < 27) and (1 < int(args.maximum) < 27):
                    for i in seq.sequ_ret():
                        seqlst.append(chr(int(i) + 64))
                else:
                    print('Please use correct range for alpha (1 - 26)')
        elif args.formatwords == "roman":
            for i in seq.roman_low_sequ():
                seqlst.append(to_romanl(i))
        elif args.formatwords == "ROMAN":
            for i in seq.roman_upper_sequ():
                seqlst.append(to_romanu(i))
        else:
            defstr = ""
            if not args.minimum:
                defstr = args.incrementer
            else:
                defstr = args.minimum
            if int_map.search(defstr):
                for i in seq.sequ_ret():
                    seqlst.append(i)
            elif type(defstr) == float:
                for i in seq.sequ_ret():
                    seqlst.append(float(i))
            elif rom_pat_up.search(defstr):
                for i in seq.roman_upper_sequ():
                    seqlst.append(i)
            elif rom_pat_low.search(defstr):
                for i in seq.roman_low_sequ():
                    seqlst.append(i)
            elif high_re.search(defstr):
                for i in seq.sequ_ret():
                    seqlst.append(chr(int(i) + 64))
            elif low_re.search(defstr):
                for i in seq.sequ_ret():
                    seqlst.append(chr(int(i) + 96))
            else:
                for i in seq.sequ_ret():
                    seqlst.append(i)
    else:
        for i in seq.sequ_ret():
            seqlst.append(i)
    return seqlst