ver Jan11thv2
a new Thunderbird example w.r.t. email filter
This commit is contained in:
@@ -13,8 +13,10 @@ from rapidfuzz import fuzz
|
||||
import functools
|
||||
import re
|
||||
|
||||
def _match_record(pattern: Dict[str, str], item: Dict[str, str]) -> bool:
|
||||
return all(k in item and item[k]==val for k, val in pattern.items())
|
||||
from .utils import _match_record
|
||||
|
||||
#def _match_record(pattern: Dict[str, str], item: Dict[str, str]) -> bool:
|
||||
#return all(k in item and item[k]==val for k, val in pattern.items())
|
||||
|
||||
def check_csv(result: str, rules: Dict[str, List[Dict[str, str]]]) -> float:
|
||||
"""
|
||||
@@ -30,6 +32,9 @@ def check_csv(result: str, rules: Dict[str, List[Dict[str, str]]]) -> float:
|
||||
float
|
||||
"""
|
||||
|
||||
if result is None:
|
||||
return 0.
|
||||
|
||||
expect_metrics = [False] * len(rules.get("expect", []))
|
||||
unexpect_metric = True
|
||||
with open(result) as f:
|
||||
@@ -55,6 +60,9 @@ def check_list(result: str, rules: Dict[str, List[str]]) -> float:
|
||||
float
|
||||
"""
|
||||
|
||||
if result is None:
|
||||
return 0.
|
||||
|
||||
expect_patterns: List[Pattern[str]] = [re.compile(ptt) for ptt in rules.get("expect", [])]
|
||||
unexpect_patterns: List[Pattern[str]] = [re.compile(ptt) for ptt in rules.get("unexpect", [])]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user