Skip to content

Commit 49991fe

Browse files
committed
misc: pre-commit
1 parent 7fc8f45 commit 49991fe

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

src/plumpy/broadcast_filter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2+
# type: ignore
23
import re
34
import typing
45

src/plumpy/controller.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def play_process(self, pid: 'PID_TYPE') -> ProcessResult:
5252
...
5353

5454
def play_all(self) -> None:
55-
"""Play all processes that are subscribed to the same coordinator
56-
"""
55+
"""Play all processes that are subscribed to the same coordinator"""
5756

5857
def kill_process(self, pid: 'PID_TYPE', msg_text: str | None = None) -> Any:
5958
"""Kill the process

src/plumpy/coordinator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import annotations
33

4-
from typing import TYPE_CHECKING, Any, Callable, Hashable, Protocol
54
from re import Pattern
5+
from typing import TYPE_CHECKING, Any, Callable, Hashable, Protocol
66

77
if TYPE_CHECKING:
88
ID_TYPE = Hashable
@@ -36,7 +36,11 @@ def unhook_broadcast_receiver(self, identifier: 'ID_TYPE | None') -> None: ...
3636

3737
def unhook_task_receiver(self, identifier: 'ID_TYPE') -> None: ...
3838

39-
def rpc_send(self, recipient_id: Hashable, msg: Any,) -> Any: ...
39+
def rpc_send(
40+
self,
41+
recipient_id: Hashable,
42+
msg: Any,
43+
) -> Any: ...
4044

4145
def broadcast_send(
4246
self,

src/plumpy/message.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import logging
88
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Union, cast
99

10-
from plumpy.coordinator import Coordinator
1110
from plumpy.exceptions import PersistenceError, TaskRejectedError
1211

1312
from . import loaders, persistence

src/plumpy/processes.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
cast,
3535
)
3636

37-
import kiwipy
38-
39-
from plumpy.broadcast_filter import BroadcastFilter
37+
from plumpy.broadcast_filter import BroadcastFilter # type: ignore
4038
from plumpy.coordinator import Coordinator
4139

4240
try:
@@ -944,19 +942,16 @@ def _fire_event(self, evt: Callable[..., Any], *args: Any, **kwargs: Any) -> Non
944942
# region Communication
945943

946944
def message_receive(self, msg: MessageType) -> Any:
947-
"""
948-
Coroutine called when the process receives a message from the communicator
945+
"""Coroutine called when the process receives a message from the communicator
949946
950-
:param _comm: the communicator that sent the message
951947
:param msg: the message
952948
:return: the outcome of processing the message, the return value will be sent back as a response to the sender
953949
"""
954-
# self.logger.debug(
955-
# "Process<%s>: received RPC message with communicator '%s': %r",
956-
# self.pid,
957-
# _comm,
958-
# msg,
959-
# )
950+
self.logger.debug(
951+
"Process<%s>: received RPC message: %r",
952+
self.pid,
953+
msg,
954+
)
960955

961956
intent = msg[message.INTENT_KEY]
962957

@@ -977,19 +972,17 @@ def message_receive(self, msg: MessageType) -> Any:
977972
def broadcast_receive(
978973
self, msg: MessageType, sender: Any, subject: Any, correlation_id: Any
979974
) -> Optional[concurrent.futures.Future]:
980-
"""
981-
Coroutine called when the process receives a message from the communicator
975+
"""Coroutine called when the process receives a message from the communicator
982976
983977
:param msg: the message
984978
"""
979+
self.logger.debug(
980+
"Process<%s>: received broadcast message '%s': %r",
981+
self.pid,
982+
subject,
983+
msg,
984+
)
985985

986-
# self.logger.debug(
987-
# "Process<%s>: received broadcast message '%s' with communicator '%s': %r",
988-
# self.pid,
989-
# subject,
990-
# _comm,
991-
# msg,
992-
# )
993986
# If we get a message we recognise then action it, otherwise ignore
994987
fn = None
995988
if subject == message.Intent.PLAY:

src/plumpy/rmq/communications.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def converted(communicator: kiwipy.Communicator, *args: Any, **kwargs: Any) -> k
8282
CommT = TypeVar('CommT', bound=kiwipy.Communicator)
8383

8484

85-
def wrap_communicator(communicator: CommT, loop: Optional[asyncio.AbstractEventLoop] = None) -> 'LoopCommunicator[CommT]':
85+
def wrap_communicator(
86+
communicator: CommT, loop: Optional[asyncio.AbstractEventLoop] = None
87+
) -> 'LoopCommunicator[CommT]':
8688
"""
8789
Wrap a communicator such that all callbacks made to any subscribers are scheduled on the
8890
given event loop.

src/plumpy/rmq/process_control.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
ProcessStatus = Any
3030

3131

32-
# FIXME: the class not fit typing of ProcessController protocol
32+
# This class not conform with typing of ProcessController protocol.
33+
# Does't matter too much, since this controller is not directly used as the controller by downstream.
3334
class RemoteProcessController:
3435
"""
3536
Control remote processes using coroutines that will send messages and wait

tests/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
"""Utilities for tests"""
3+
from __future__ import annotations
34

45
import asyncio
56
import collections
@@ -105,7 +106,7 @@ def hook_broadcast_receiver(
105106
self._broadcast_receivers[identifier] = receiver
106107
return identifier
107108

108-
def unhook_broadcast_receiver(self, identifier: 'ID_TYPE | None') -> None:
109+
def unhook_broadcast_receiver(self, identifier: 'ID_TYPE | None') -> None:
109110
self._ensure_open()
110111
try:
111112
del self._broadcast_receivers[identifier]

0 commit comments

Comments
 (0)