summaryrefslogtreecommitdiffstats
path: root/patchwork/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'patchwork/parser.py')
-rw-r--r--patchwork/parser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/patchwork/parser.py b/patchwork/parser.py
index a51a7b6..8afb334 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -21,6 +21,7 @@
import re
+from collections import Counter
try:
import hashlib
@@ -234,6 +235,14 @@ def hash_patch(str):
return hash
+def extract_tags(content, tags):
+ counts = Counter()
+
+ for tag in tags:
+ regex = re.compile(tag.pattern, re.MULTILINE | re.IGNORECASE)
+ counts[tag] = len(regex.findall(content))
+
+ return counts
def main(args):
from optparse import OptionParser