Skip to content

Commit

Permalink
Put publisher typevar specification back in
Browse files Browse the repository at this point in the history
  • Loading branch information
fajpunk committed Dec 10, 2024
1 parent 44eae9a commit b179ce2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions safir/src/safir/metrics/_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

0 comments on commit b179ce2

Please sign in to comment.