forked from p34709852/monkey
Common: Make PydanticEventSerializer generic
This commit is contained in:
parent
62ab6e5a77
commit
34e843f7f3
|
@ -1,5 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Type, TypeVar
|
from typing import Generic, Type, TypeVar
|
||||||
|
|
||||||
from common.events import AbstractAgentEvent
|
from common.events import AbstractAgentEvent
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
|
||||||
T = TypeVar("T", bound=AbstractAgentEvent)
|
T = TypeVar("T", bound=AbstractAgentEvent)
|
||||||
|
|
||||||
|
|
||||||
class PydanticEventSerializer(IEventSerializer):
|
class PydanticEventSerializer(IEventSerializer, Generic[T]):
|
||||||
def __init__(self, event_class: Type[T]):
|
def __init__(self, event_class: Type[T]):
|
||||||
self._event_class = event_class
|
self._event_class = event_class
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue