grasp_agents 0.5.2__py3-none-any.whl → 0.5.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- grasp_agents/__init__.py +3 -4
- grasp_agents/errors.py +80 -18
- grasp_agents/llm_agent.py +36 -58
- grasp_agents/llm_policy_executor.py +2 -2
- grasp_agents/packet.py +23 -4
- grasp_agents/packet_pool.py +117 -50
- grasp_agents/printer.py +8 -4
- grasp_agents/processor.py +208 -163
- grasp_agents/prompt_builder.py +80 -105
- grasp_agents/run_context.py +1 -9
- grasp_agents/runner.py +110 -21
- grasp_agents/typing/events.py +8 -4
- grasp_agents/typing/io.py +1 -1
- grasp_agents/workflow/looped_workflow.py +47 -52
- grasp_agents/workflow/sequential_workflow.py +6 -10
- grasp_agents/workflow/workflow_processor.py +7 -15
- {grasp_agents-0.5.2.dist-info → grasp_agents-0.5.4.dist-info}/METADATA +1 -1
- {grasp_agents-0.5.2.dist-info → grasp_agents-0.5.4.dist-info}/RECORD +20 -21
- grasp_agents/comm_processor.py +0 -214
- {grasp_agents-0.5.2.dist-info → grasp_agents-0.5.4.dist-info}/WHEEL +0 -0
- {grasp_agents-0.5.2.dist-info → grasp_agents-0.5.4.dist-info}/licenses/LICENSE.md +0 -0
@@ -3,22 +3,19 @@ from itertools import pairwise
|
|
3
3
|
from typing import Any, Generic, cast, final
|
4
4
|
|
5
5
|
from ..errors import WorkflowConstructionError
|
6
|
-
from ..packet_pool import Packet
|
6
|
+
from ..packet_pool import Packet
|
7
7
|
from ..processor import Processor
|
8
8
|
from ..run_context import CtxT, RunContext
|
9
9
|
from ..typing.events import Event, ProcPacketOutputEvent, WorkflowResultEvent
|
10
|
-
from ..typing.io import InT,
|
10
|
+
from ..typing.io import InT, OutT, ProcName
|
11
11
|
from .workflow_processor import WorkflowProcessor
|
12
12
|
|
13
13
|
|
14
|
-
class SequentialWorkflow(
|
15
|
-
WorkflowProcessor[InT, OutT_co, CtxT], Generic[InT, OutT_co, CtxT]
|
16
|
-
):
|
14
|
+
class SequentialWorkflow(WorkflowProcessor[InT, OutT, CtxT], Generic[InT, OutT, CtxT]):
|
17
15
|
def __init__(
|
18
16
|
self,
|
19
17
|
name: ProcName,
|
20
18
|
subprocs: Sequence[Processor[Any, Any, Any, CtxT]],
|
21
|
-
packet_pool: PacketPool[CtxT] | None = None,
|
22
19
|
recipients: list[ProcName] | None = None,
|
23
20
|
max_retries: int = 0,
|
24
21
|
) -> None:
|
@@ -27,7 +24,6 @@ class SequentialWorkflow(
|
|
27
24
|
start_proc=subprocs[0],
|
28
25
|
end_proc=subprocs[-1],
|
29
26
|
name=name,
|
30
|
-
packet_pool=packet_pool,
|
31
27
|
recipients=recipients,
|
32
28
|
max_retries=max_retries,
|
33
29
|
)
|
@@ -50,7 +46,7 @@ class SequentialWorkflow(
|
|
50
46
|
forgetful: bool = False,
|
51
47
|
call_id: str | None = None,
|
52
48
|
ctx: RunContext[CtxT] | None = None,
|
53
|
-
) -> Packet[
|
49
|
+
) -> Packet[OutT]:
|
54
50
|
call_id = self._generate_call_id(call_id)
|
55
51
|
|
56
52
|
packet = in_packet
|
@@ -66,7 +62,7 @@ class SequentialWorkflow(
|
|
66
62
|
chat_inputs = None
|
67
63
|
in_args = None
|
68
64
|
|
69
|
-
return cast("Packet[
|
65
|
+
return cast("Packet[OutT]", packet)
|
70
66
|
|
71
67
|
@final
|
72
68
|
async def run_stream( # type: ignore[override]
|
@@ -99,5 +95,5 @@ class SequentialWorkflow(
|
|
99
95
|
in_args = None
|
100
96
|
|
101
97
|
yield WorkflowResultEvent(
|
102
|
-
data=cast("Packet[
|
98
|
+
data=cast("Packet[OutT]", packet), proc_name=self.name, call_id=call_id
|
103
99
|
)
|
@@ -2,37 +2,29 @@ from abc import ABC, abstractmethod
|
|
2
2
|
from collections.abc import AsyncIterator, Sequence
|
3
3
|
from typing import Any, Generic
|
4
4
|
|
5
|
-
from ..comm_processor import CommProcessor
|
6
5
|
from ..errors import WorkflowConstructionError
|
7
6
|
from ..packet import Packet
|
8
|
-
from ..packet_pool import PacketPool
|
9
7
|
from ..processor import Processor
|
10
8
|
from ..run_context import CtxT, RunContext
|
11
9
|
from ..typing.events import Event
|
12
|
-
from ..typing.io import InT,
|
10
|
+
from ..typing.io import InT, OutT, ProcName
|
13
11
|
|
14
12
|
|
15
13
|
class WorkflowProcessor(
|
16
|
-
|
14
|
+
Processor[InT, OutT, Any, CtxT],
|
17
15
|
ABC,
|
18
|
-
Generic[InT,
|
16
|
+
Generic[InT, OutT, CtxT],
|
19
17
|
):
|
20
18
|
def __init__(
|
21
19
|
self,
|
22
20
|
name: ProcName,
|
23
21
|
subprocs: Sequence[Processor[Any, Any, Any, CtxT]],
|
24
22
|
start_proc: Processor[InT, Any, Any, CtxT],
|
25
|
-
end_proc: Processor[Any,
|
26
|
-
packet_pool: PacketPool[CtxT] | None = None,
|
23
|
+
end_proc: Processor[Any, OutT, Any, CtxT],
|
27
24
|
recipients: list[ProcName] | None = None,
|
28
25
|
max_retries: int = 0,
|
29
26
|
) -> None:
|
30
|
-
super().__init__(
|
31
|
-
name=name,
|
32
|
-
packet_pool=packet_pool,
|
33
|
-
recipients=recipients,
|
34
|
-
max_retries=max_retries,
|
35
|
-
)
|
27
|
+
super().__init__(name=name, recipients=recipients, max_retries=max_retries)
|
36
28
|
|
37
29
|
self._in_type = start_proc.in_type
|
38
30
|
self._out_type = end_proc.out_type
|
@@ -61,7 +53,7 @@ class WorkflowProcessor(
|
|
61
53
|
return self._start_proc
|
62
54
|
|
63
55
|
@property
|
64
|
-
def end_proc(self) -> Processor[Any,
|
56
|
+
def end_proc(self) -> Processor[Any, OutT, Any, CtxT]:
|
65
57
|
return self._end_proc
|
66
58
|
|
67
59
|
def _generate_subproc_call_id(
|
@@ -79,7 +71,7 @@ class WorkflowProcessor(
|
|
79
71
|
ctx: RunContext[CtxT] | None = None,
|
80
72
|
forgetful: bool = False,
|
81
73
|
call_id: str | None = None,
|
82
|
-
) -> Packet[
|
74
|
+
) -> Packet[OutT]:
|
83
75
|
pass
|
84
76
|
|
85
77
|
@abstractmethod
|
@@ -1,23 +1,22 @@
|
|
1
|
-
grasp_agents/__init__.py,sha256=
|
1
|
+
grasp_agents/__init__.py,sha256=NfnMiLttHb5iudzeDoLAK-wHCK0QBo0guPcupM99ISU,896
|
2
2
|
grasp_agents/cloud_llm.py,sha256=C6xrKYhiQb4tNXK_rFo2pNlVTXPS_gYd5uevAnpLFeE,13119
|
3
|
-
grasp_agents/comm_processor.py,sha256=Tg6At2Ybow2WnJNvykOXKol4z5k3l8ED-GSesnA6aG0,6816
|
4
3
|
grasp_agents/costs_dict.yaml,sha256=2MFNWtkv5W5WSCcv1Cj13B1iQLVv5Ot9pS_KW2Gu2DA,2510
|
5
|
-
grasp_agents/errors.py,sha256=
|
4
|
+
grasp_agents/errors.py,sha256=K-22TCM1Klhsej47Rg5eTqnGiGPaXgKOpdOZZ7cPipw,4633
|
6
5
|
grasp_agents/generics_utils.py,sha256=5Pw3I9dlnKC2VGqYKC4ZZUO3Z_vTNT-NPFovNfPkl6I,6542
|
7
6
|
grasp_agents/grasp_logging.py,sha256=H1GYhXdQvVkmauFDZ-KDwvVmPQHZUUm9sRqX_ObK2xI,1111
|
8
7
|
grasp_agents/http_client.py,sha256=Es8NXGDkp4Nem7g24-jW0KFGA9Hp_o2Cv3cOvjup-iU,859
|
9
8
|
grasp_agents/llm.py,sha256=YCzHlb2gdWVy77DmQpcu0dyEzGp4VQa3UMRJKodCYSs,6557
|
10
|
-
grasp_agents/llm_agent.py,sha256=
|
9
|
+
grasp_agents/llm_agent.py,sha256=oUMNe5yXt0JKHmVNGSpR1nyb5KyYDkrz9Nyn8sBxx1g,13682
|
11
10
|
grasp_agents/llm_agent_memory.py,sha256=GZ2Z66_JC_sR10vATvR53ui62xxY4lDDtL0XvL_AQNk,1846
|
12
|
-
grasp_agents/llm_policy_executor.py,sha256=
|
11
|
+
grasp_agents/llm_policy_executor.py,sha256=jYJENUooaEz5u-ZkgCijcGIJhA2CFkXQH2TUz5KwgB4,16822
|
13
12
|
grasp_agents/memory.py,sha256=keHuNEZNSxHT9FKpMohHOCNi7UAz_oRIc91IQEuzaWE,1162
|
14
|
-
grasp_agents/packet.py,sha256=
|
15
|
-
grasp_agents/packet_pool.py,sha256=
|
16
|
-
grasp_agents/printer.py,sha256=
|
17
|
-
grasp_agents/processor.py,sha256=
|
18
|
-
grasp_agents/prompt_builder.py,sha256=
|
19
|
-
grasp_agents/run_context.py,sha256=
|
20
|
-
grasp_agents/runner.py,sha256=
|
13
|
+
grasp_agents/packet.py,sha256=EmE-W4ZSMVZoqClECGFe7OGqrT4FSJ8IVGICrdjtdEY,1462
|
14
|
+
grasp_agents/packet_pool.py,sha256=A5hqEvh7XwaPJVkfbItMm5FQqxujVzXDId7HnSUqluI,4919
|
15
|
+
grasp_agents/printer.py,sha256=RvUXPtbD6pdhGxoKZiddKlfMRH6WaSAIdoJSEkmpId8,11041
|
16
|
+
grasp_agents/processor.py,sha256=tJTD2T1cmuQ-m_7bsVFsF7k4oZafh_f0p2uqdng2-sA,17053
|
17
|
+
grasp_agents/prompt_builder.py,sha256=IFvwvl_YqwL_LGfmauf4Gr1DUGZWkHsKk0ZABFnR6HI,7124
|
18
|
+
grasp_agents/run_context.py,sha256=f8PasaPDCBiR59AFTHRIp1wxIPAQSzJGvv_kglWOGlk,1098
|
19
|
+
grasp_agents/runner.py,sha256=nZXK5OuM7QbLyzNA-rfXD0YDtdftTK5v2cCpeujhe2k,4479
|
21
20
|
grasp_agents/usage_tracker.py,sha256=ZQfVUUpG0C89hyPWT_JgXnjQOxoYmumcQ9t-aCfcMo8,3561
|
22
21
|
grasp_agents/utils.py,sha256=qKmGBwrQHw1-BgqRLuGTPKGs3J_zbrpk3nxnP1iZBiQ,6152
|
23
22
|
grasp_agents/litellm/__init__.py,sha256=wD8RZBYokFDfbS9Cs7nO_zKb3w7RIVwEGj7g2D5CJH0,4510
|
@@ -43,15 +42,15 @@ grasp_agents/typing/completion.py,sha256=PHJ01m7WI2KYQL8w7W2ti6hMsKEZnzYGaxbNcBC
|
|
43
42
|
grasp_agents/typing/completion_chunk.py,sha256=t6PvkDWQxRN5xA4efBdeou46RifMFodBmZc45Sx7qxQ,7610
|
44
43
|
grasp_agents/typing/content.py,sha256=XFmLpNWkGhkw5JujO6UsYwhzTHkU67PfhzaXH2waLcQ,3659
|
45
44
|
grasp_agents/typing/converters.py,sha256=kHlocHQS8QnduZOzNPbj3aRD8JpvJd53oudYqWdOxKE,2978
|
46
|
-
grasp_agents/typing/events.py,sha256=
|
47
|
-
grasp_agents/typing/io.py,sha256=
|
45
|
+
grasp_agents/typing/events.py,sha256=1n6EVS8vU0RLlQHMHUjiV5i4PYLovT7RcOmpcx0ztlc,5256
|
46
|
+
grasp_agents/typing/io.py,sha256=WmFfAVnqd4uNQygNAmlo0BX3q8focS6KLvCChmM0ep8,215
|
48
47
|
grasp_agents/typing/message.py,sha256=o7bN84AgrC5Fm3Wx20gqL9ArAMcEtYvnHnXbb04ngCs,3224
|
49
48
|
grasp_agents/typing/tool.py,sha256=4N-k_GvHVPAFyVyEq7z_LYKkA24iQlGoVYiWCzGTgT4,1786
|
50
49
|
grasp_agents/workflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
51
|
-
grasp_agents/workflow/looped_workflow.py,sha256=
|
52
|
-
grasp_agents/workflow/sequential_workflow.py,sha256=
|
53
|
-
grasp_agents/workflow/workflow_processor.py,sha256=
|
54
|
-
grasp_agents-0.5.
|
55
|
-
grasp_agents-0.5.
|
56
|
-
grasp_agents-0.5.
|
57
|
-
grasp_agents-0.5.
|
50
|
+
grasp_agents/workflow/looped_workflow.py,sha256=J-mdy1gxsMUC622j8W-_fDX3oAyKHg9TTzCXEksMS-Q,6311
|
51
|
+
grasp_agents/workflow/sequential_workflow.py,sha256=7xBl6YtH97y6jSv6eAHtSIeKjoqiUWKu63C-gKp6Eus,3295
|
52
|
+
grasp_agents/workflow/workflow_processor.py,sha256=56XC6KDRQuRftwhWnALmPUlQWCGfuTPRgIznyV2-tOg,2776
|
53
|
+
grasp_agents-0.5.4.dist-info/METADATA,sha256=ePDw81wa-FDQu1jj46FN4tO4yUkgCt7lvn_0mDcwaDA,6865
|
54
|
+
grasp_agents-0.5.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
55
|
+
grasp_agents-0.5.4.dist-info/licenses/LICENSE.md,sha256=-nNNdWqGB8gJ2O-peFQ2Irshv5tW5pHKyTcYkwvH7CE,1201
|
56
|
+
grasp_agents-0.5.4.dist-info/RECORD,,
|
grasp_agents/comm_processor.py
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
from collections.abc import AsyncIterator, Sequence
|
3
|
-
from typing import Any, ClassVar, Generic, Protocol, TypeVar, cast
|
4
|
-
|
5
|
-
from .errors import PacketRoutingError
|
6
|
-
from .memory import MemT
|
7
|
-
from .packet import Packet
|
8
|
-
from .packet_pool import PacketPool
|
9
|
-
from .processor import Processor
|
10
|
-
from .run_context import CtxT, RunContext
|
11
|
-
from .typing.events import Event, ProcPacketOutputEvent, RunResultEvent
|
12
|
-
from .typing.io import InT, OutT_co, ProcName
|
13
|
-
|
14
|
-
logger = logging.getLogger(__name__)
|
15
|
-
|
16
|
-
|
17
|
-
_OutT_contra = TypeVar("_OutT_contra", contravariant=True)
|
18
|
-
|
19
|
-
|
20
|
-
class ExitCommunicationHandler(Protocol[_OutT_contra, CtxT]):
|
21
|
-
def __call__(
|
22
|
-
self,
|
23
|
-
out_packet: Packet[_OutT_contra],
|
24
|
-
ctx: RunContext[CtxT],
|
25
|
-
) -> bool: ...
|
26
|
-
|
27
|
-
|
28
|
-
class SetRecipientsHandler(Protocol[_OutT_contra, CtxT]):
|
29
|
-
def __call__(
|
30
|
-
self, out_packet: Packet[_OutT_contra], ctx: RunContext[CtxT]
|
31
|
-
) -> None: ...
|
32
|
-
|
33
|
-
|
34
|
-
class CommProcessor(
|
35
|
-
Processor[InT, OutT_co, MemT, CtxT],
|
36
|
-
Generic[InT, OutT_co, MemT, CtxT],
|
37
|
-
):
|
38
|
-
_generic_arg_to_instance_attr_map: ClassVar[dict[int, str]] = {
|
39
|
-
0: "_in_type",
|
40
|
-
1: "_out_type",
|
41
|
-
}
|
42
|
-
|
43
|
-
def __init__(
|
44
|
-
self,
|
45
|
-
name: ProcName,
|
46
|
-
*,
|
47
|
-
recipients: Sequence[ProcName] | None = None,
|
48
|
-
packet_pool: PacketPool[CtxT] | None = None,
|
49
|
-
max_retries: int = 0,
|
50
|
-
) -> None:
|
51
|
-
super().__init__(name=name, max_retries=max_retries)
|
52
|
-
|
53
|
-
self.recipients = recipients or []
|
54
|
-
self._packet_pool = packet_pool
|
55
|
-
self._is_listening = False
|
56
|
-
|
57
|
-
self._exit_communication_impl: (
|
58
|
-
ExitCommunicationHandler[OutT_co, CtxT] | None
|
59
|
-
) = None
|
60
|
-
self._set_recipients_impl: SetRecipientsHandler[OutT_co, CtxT] | None = None
|
61
|
-
|
62
|
-
@property
|
63
|
-
def packet_pool(self) -> PacketPool[CtxT] | None:
|
64
|
-
return self._packet_pool
|
65
|
-
|
66
|
-
@property
|
67
|
-
def is_listening(self) -> bool:
|
68
|
-
return self._is_listening
|
69
|
-
|
70
|
-
def _set_recipients(
|
71
|
-
self, out_packet: Packet[OutT_co], ctx: RunContext[CtxT]
|
72
|
-
) -> None:
|
73
|
-
if self._set_recipients_impl:
|
74
|
-
self._set_recipients_impl(out_packet=out_packet, ctx=ctx)
|
75
|
-
return
|
76
|
-
|
77
|
-
out_packet.recipients = self.recipients
|
78
|
-
|
79
|
-
def _validate_routing(self, recipients: Sequence[ProcName]) -> Sequence[ProcName]:
|
80
|
-
for r in recipients:
|
81
|
-
if r not in self.recipients:
|
82
|
-
raise PacketRoutingError(
|
83
|
-
selected_recipient=r,
|
84
|
-
allowed_recipients=cast("list[str]", self.recipients),
|
85
|
-
)
|
86
|
-
|
87
|
-
return self.recipients
|
88
|
-
|
89
|
-
async def run(
|
90
|
-
self,
|
91
|
-
chat_inputs: Any | None = None,
|
92
|
-
*,
|
93
|
-
in_packet: Packet[InT] | None = None,
|
94
|
-
in_args: InT | Sequence[InT] | None = None,
|
95
|
-
forgetful: bool = False,
|
96
|
-
call_id: str | None = None,
|
97
|
-
ctx: RunContext[CtxT] | None = None,
|
98
|
-
) -> Packet[OutT_co]:
|
99
|
-
call_id = self._generate_call_id(call_id)
|
100
|
-
|
101
|
-
out_packet = await super().run(
|
102
|
-
chat_inputs=chat_inputs,
|
103
|
-
in_packet=in_packet,
|
104
|
-
in_args=in_args,
|
105
|
-
forgetful=forgetful,
|
106
|
-
call_id=call_id,
|
107
|
-
ctx=ctx,
|
108
|
-
)
|
109
|
-
|
110
|
-
if self._packet_pool is not None:
|
111
|
-
if ctx is None:
|
112
|
-
raise ValueError("RunContext must be provided when using PacketPool")
|
113
|
-
if self._exit_communication(out_packet=out_packet, ctx=ctx):
|
114
|
-
ctx.result = out_packet
|
115
|
-
await self._packet_pool.stop_all()
|
116
|
-
return out_packet
|
117
|
-
|
118
|
-
self._set_recipients(out_packet=out_packet, ctx=ctx)
|
119
|
-
out_packet.recipients = self._validate_routing(out_packet.recipients)
|
120
|
-
|
121
|
-
await self._packet_pool.post(out_packet)
|
122
|
-
|
123
|
-
return out_packet
|
124
|
-
|
125
|
-
async def run_stream(
|
126
|
-
self,
|
127
|
-
chat_inputs: Any | None = None,
|
128
|
-
*,
|
129
|
-
in_packet: Packet[InT] | None = None,
|
130
|
-
in_args: InT | Sequence[InT] | None = None,
|
131
|
-
forgetful: bool = False,
|
132
|
-
call_id: str | None = None,
|
133
|
-
ctx: RunContext[CtxT] | None = None,
|
134
|
-
) -> AsyncIterator[Event[Any]]:
|
135
|
-
call_id = self._generate_call_id(call_id)
|
136
|
-
|
137
|
-
out_packet: Packet[OutT_co] | None = None
|
138
|
-
async for event in super().run_stream(
|
139
|
-
chat_inputs=chat_inputs,
|
140
|
-
in_packet=in_packet,
|
141
|
-
in_args=in_args,
|
142
|
-
forgetful=forgetful,
|
143
|
-
call_id=call_id,
|
144
|
-
ctx=ctx,
|
145
|
-
):
|
146
|
-
if isinstance(event, ProcPacketOutputEvent):
|
147
|
-
out_packet = event.data
|
148
|
-
else:
|
149
|
-
yield event
|
150
|
-
|
151
|
-
if out_packet is None:
|
152
|
-
return
|
153
|
-
|
154
|
-
if self._packet_pool is not None:
|
155
|
-
if ctx is None:
|
156
|
-
raise ValueError("RunContext must be provided when using PacketPool")
|
157
|
-
if self._exit_communication(out_packet=out_packet, ctx=ctx):
|
158
|
-
ctx.result = out_packet
|
159
|
-
yield RunResultEvent(
|
160
|
-
data=out_packet, proc_name=self.name, call_id=call_id
|
161
|
-
)
|
162
|
-
await self._packet_pool.stop_all()
|
163
|
-
return
|
164
|
-
|
165
|
-
self._set_recipients(out_packet=out_packet, ctx=ctx)
|
166
|
-
out_packet.recipients = self._validate_routing(out_packet.recipients)
|
167
|
-
|
168
|
-
await self._packet_pool.post(out_packet)
|
169
|
-
|
170
|
-
yield ProcPacketOutputEvent(
|
171
|
-
data=out_packet, proc_name=self.name, call_id=call_id
|
172
|
-
)
|
173
|
-
|
174
|
-
def start_listening(self, ctx: RunContext[CtxT], **run_kwargs: Any) -> None:
|
175
|
-
if self._packet_pool is None:
|
176
|
-
raise RuntimeError("Packet pool must be initialized before listening")
|
177
|
-
|
178
|
-
if self._is_listening:
|
179
|
-
return
|
180
|
-
self._is_listening = True
|
181
|
-
|
182
|
-
self._packet_pool.register_packet_handler(
|
183
|
-
processor_name=self.name,
|
184
|
-
handler=self.run_stream if ctx.is_streaming else self.run, # type: ignore[call-arg]
|
185
|
-
ctx=ctx,
|
186
|
-
**run_kwargs,
|
187
|
-
)
|
188
|
-
|
189
|
-
def _exit_communication(
|
190
|
-
self, out_packet: Packet[OutT_co], ctx: RunContext[CtxT]
|
191
|
-
) -> bool:
|
192
|
-
if self._exit_communication_impl:
|
193
|
-
return self._exit_communication_impl(out_packet=out_packet, ctx=ctx)
|
194
|
-
|
195
|
-
return False
|
196
|
-
|
197
|
-
def exit_communication(
|
198
|
-
self, func: ExitCommunicationHandler[OutT_co, CtxT]
|
199
|
-
) -> ExitCommunicationHandler[OutT_co, CtxT]:
|
200
|
-
self._exit_communication_impl = func
|
201
|
-
|
202
|
-
return func
|
203
|
-
|
204
|
-
def set_recipients(
|
205
|
-
self, func: SetRecipientsHandler[OutT_co, CtxT]
|
206
|
-
) -> SetRecipientsHandler[OutT_co, CtxT]:
|
207
|
-
self._select_recipients_impl = func
|
208
|
-
|
209
|
-
return func
|
210
|
-
|
211
|
-
# async def stop_listening(self) -> None:
|
212
|
-
# assert self._packet_pool is not None
|
213
|
-
# self._is_listening = False
|
214
|
-
# await self._packet_pool.unregister_packet_handler(self.name)
|
File without changes
|
File without changes
|