From f18c95cdf7bac066a1fc30c89159267ee8f51219 Mon Sep 17 00:00:00 2001 From: Denis Nutiu Date: Mon, 5 Jun 2023 11:52:50 +0300 Subject: [PATCH] use dataclass for RegexCallback --- app/converter/regex_heuristics.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/converter/regex_heuristics.py b/app/converter/regex_heuristics.py index dcae31c..ed7d913 100644 --- a/app/converter/regex_heuristics.py +++ b/app/converter/regex_heuristics.py @@ -1,9 +1,14 @@ +import dataclasses import re -from collections import namedtuple +from typing import Callable from app import utils -RegexCallback = namedtuple("RegexCallback", ["callback", "name"]) + +@dataclasses.dataclass +class RegexCallback: + callback: Callable[[re.Match], str] + name: str class RegexHeuristics: