Add a filter for tags.

This commit is contained in:
2023-06-18 22:44:46 +03:00
parent 62743cc3b2
commit e7ec870159
2 changed files with 13 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import re
class TagsFilter:
def __init__(self):
self._pattern = r'-\D\w+'
self.regexp = re.compile(self._pattern)
def check(self):
return lambda tag: len(self.regexp.findall(tag)) == 0
def filter_list(self, tags: list):
return list(filter(self.check(), tags))