Skip to content

Commit

Permalink
ralex - T -> CommT in generic type at communications.py
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Feb 24, 2025
1 parent 094a043 commit 7fc8f45
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/plumpy/rmq/communications.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def converted(communicator: kiwipy.Communicator, *args: Any, **kwargs: Any) -> k
return converted


T = TypeVar('T', bound=kiwipy.Communicator)
CommT = TypeVar('CommT', bound=kiwipy.Communicator)


def wrap_communicator(communicator: T, loop: Optional[asyncio.AbstractEventLoop] = None) -> 'LoopCommunicator[T]':
def wrap_communicator(communicator: CommT, loop: Optional[asyncio.AbstractEventLoop] = None) -> 'LoopCommunicator[CommT]':
"""
Wrap a communicator such that all callbacks made to any subscribers are scheduled on the
given event loop.
Expand All @@ -103,10 +103,10 @@ def wrap_communicator(communicator: T, loop: Optional[asyncio.AbstractEventLoop]


@final
class LoopCommunicator(Generic[T], kiwipy.Communicator): # type: ignore
class LoopCommunicator(Generic[CommT], kiwipy.Communicator): # type: ignore
"""Wrapper around a `kiwipy.Communicator` that schedules any subscriber messages on a given event loop."""

def __init__(self, communicator: T, loop: Optional[asyncio.AbstractEventLoop] = None):
def __init__(self, communicator: CommT, loop: Optional[asyncio.AbstractEventLoop] = None):
"""
:param communicator: The kiwipy communicator
:param loop: The event loop to schedule callbacks on
Expand All @@ -118,7 +118,7 @@ def __init__(self, communicator: T, loop: Optional[asyncio.AbstractEventLoop] =
self._loop: asyncio.AbstractEventLoop = loop or asyncio.get_event_loop()

@property
def inner(self) -> T:
def inner(self) -> CommT:
return self._communicator

def loop(self) -> asyncio.AbstractEventLoop:
Expand Down

0 comments on commit 7fc8f45

Please sign in to comment.