From b179ce2097f245a7d4917c37593d19a7e1b05c62 Mon Sep 17 00:00:00 2001 From: Dan Fuchs Date: Mon, 9 Dec 2024 21:40:31 -0600 Subject: [PATCH] Put publisher typevar specification back in --- safir/src/safir/metrics/_event_manager.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/safir/src/safir/metrics/_event_manager.py b/safir/src/safir/metrics/_event_manager.py index 44fdc2d9..861d2d69 100644 --- a/safir/src/safir/metrics/_event_manager.py +++ b/safir/src/safir/metrics/_event_manager.py @@ -5,7 +5,7 @@ import time from abc import ABCMeta, abstractmethod from datetime import UTC, datetime -from typing import Generic, TypeVar, cast +from typing import Generic, TypeVar, cast, reveal_type from uuid import uuid4 import structlog @@ -334,6 +334,7 @@ class Meta: # Build the publisher, store it to detect duplicates, and return it. publisher = await self.build_publisher_for_model(model) + reveal_type(publisher) self._publishers[name] = publisher return publisher @@ -469,7 +470,7 @@ async def build_publisher_for_model( schema_info = await self._schema_manager.register_model(model) # Return the corresponding event publisher. - return KafkaEventPublisher( + return KafkaEventPublisher[P]( application=self._application, event_class=model, publisher=async_publisher, @@ -586,7 +587,7 @@ async def build_publisher_for_model( EventPublisher An appropriate event publisher implementation instance. """ - return NoopEventPublisher(self._application, model, self.logger) + return NoopEventPublisher[P](self._application, model, self.logger) class MockEventManager(EventManager): @@ -636,4 +637,4 @@ async def build_publisher_for_model( EventPublisher An appropriate event publisher implementation instance. """ - return MockEventPublisher(self._application, model, self.logger) + return MockEventPublisher[P](self._application, model, self.logger)