From cf7ff69810f3005f7b88bd95ccebee5953cc7d23 Mon Sep 17 00:00:00 2001 From: "A.Shpak" Date: Fri, 22 Mar 2024 10:56:02 +0300 Subject: [PATCH] - --- chatushka/_chatushka.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chatushka/_chatushka.py b/chatushka/_chatushka.py index f155092..690deaa 100644 --- a/chatushka/_chatushka.py +++ b/chatushka/_chatushka.py @@ -4,6 +4,7 @@ AbstractAsyncContextManager, asynccontextmanager, ) +from re import RegexFlag from typing import Any, final from chatushka.__version__ import __version__ @@ -100,6 +101,7 @@ def add_regex( self, *patterns: str, action: Callable, + re_flags: int | RegexFlag = 0, chance_rate: float = 1.0, results_model: type[Any] | None = None, ) -> None: @@ -107,6 +109,7 @@ def add_regex( RegExMatcher( *patterns, action=action, + re_flags=re_flags, chance_rate=chance_rate, results_model=results_model, ) @@ -115,6 +118,7 @@ def add_regex( def regex( self, *patterns: str, + re_flags: int | RegexFlag = 0, chance_rate: float = 1.0, results_model: type[Any] | None = None, ) -> Callable: @@ -124,6 +128,7 @@ def _wrapper( self.add_regex( *patterns, action=func, + re_flags=re_flags, chance_rate=chance_rate, results_model=results_model, )