def info(message): return printStdError(color('36;1'," "+message))
def smallstep(message): return printStdError(color('32;1'," "+message))
def printcolor(colorcode, message): printStdError(color(colorcode, message))
def bigstep(message): return printStdError(color('32;1',"\n:: "+message))
column for board in matchingboards for column in board.open_lists() if listfilter.lower() in column.name.lower() ] matchinglists or fail("No list cointaining '{}' in name".format(listfilter)) if len(matchinglists) > 1: fail(u"Only one list should be matched, but matched {}:\n{}", -1, len(matchinglists), '\n'.join(l.name for l in matchinglists)) chosenlist = matchinglists[0] effort_re = r'\s*\(\s*[0-9]+\s*/\s*[0-9]+\s*\)\s*' listcards = (card for card in chosenlist.list_cards() if '--^^--' not in card.name) for i, card in enumerate(listcards): printStdOut(color('34;1', card.url)) printStdOut(color('32;1', "Old: " + card.name)) cleaned = re.sub(r'\s*\[P[0-9]+\]\s*', ' ', card.name) effort = re.search(effort_re, cleaned) if not effort: warn("Card without effort setting it to (0/0)") effort = '(0/0)' else: effort = ''.join(effort.group().strip().split()) cleaned = re.sub(effort_re, ' ', cleaned).strip() if action == 'clean': newname = u'{} {}'.format(effort, cleaned) else: newname = u'{} [P{}] {}'.format(effort, i, cleaned) printStdOut(color('35;1', "New: " + newname))