From c990518cb533a793399e44edbb4bc036342c7175 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Sat, 4 Jan 2025 22:38:23 +0800 Subject: feat(core): Initialize core components and configuration models --- src/hrc/typing.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/hrc/typing.py (limited to 'src/hrc/typing.py') diff --git a/src/hrc/typing.py b/src/hrc/typing.py new file mode 100644 index 0000000..a207c80 --- /dev/null +++ b/src/hrc/typing.py @@ -0,0 +1,23 @@ +# ruff: noqa: TCH001 +from typing import TYPE_CHECKING, Awaitable, Callable, Optional, TypeVar + +if TYPE_CHECKING: + from typing import Any + + from hrc.service import Service + from hrc.core import Core + from hrc.config import ConfigModel + from hrc.event import Event + from hrc.rule import Rule + + +StateT = TypeVar("StateT") +EventT = TypeVar("EventT", bound="Event[Any]") +RuleT = TypeVar("RuleT", bound="Rule[Any, Any, Any]") +ConfigT = TypeVar("ConfigT", bound=Optional["ConfigModel"]) +ServiceT = TypeVar("ServiceT", bound="Service[Any, Any]") + +CoreHook = Callable[["Core"], Awaitable[None]] +RuleHook = Callable[["Rule"], Awaitable[None]] +ServiceHook = Callable[["Service[Any, Any]"], Awaitable[None]] +EventHook = Callable[["Event[Any]"], Awaitable[None]] -- cgit v1.2.3-70-g09d2