carlos / todomvc-bakeoff Public

Clone
git clone https://amadan.net/carlos/todomvc-bakeoff

Plain git — no account needed to clone.

Download

Download this file

1#!/usr/bin/env python3
2"""Prints only the [security] items of a numbered review list."""
3import re, sys
4items, cur = [], None
5for line in open(sys.argv[1]).read().splitlines():
6 if re.match(r"\s*\d+\.\s+", line):
7 cur = [line]; items.append(cur)
8 elif cur is not None:
9 cur.append(line)
10print("\n".join("\n".join(i) for i in items if re.match(r"\s*\d+\.\s+\[security\]", i[0])))
11