Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
A.Shpak committed Mar 22, 2024
1 parent 80635a3 commit cf7ff69
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chatushka/_chatushka.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
AbstractAsyncContextManager,
asynccontextmanager,
)
from re import RegexFlag
from typing import Any, final

from chatushka.__version__ import __version__
Expand Down Expand Up @@ -100,13 +101,15 @@ 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:
self.add_matcher(
RegExMatcher(
*patterns,
action=action,
re_flags=re_flags,
chance_rate=chance_rate,
results_model=results_model,
)
Expand All @@ -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:
Expand All @@ -124,6 +128,7 @@ def _wrapper(
self.add_regex(
*patterns,
action=func,
re_flags=re_flags,
chance_rate=chance_rate,
results_model=results_model,
)
Expand Down

0 comments on commit cf7ff69

Please sign in to comment.