python-cq 0.11.0__tar.gz → 0.11.1__tar.gz
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.
- {python_cq-0.11.0 → python_cq-0.11.1}/PKG-INFO +1 -1
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/dispatcher/pipe.py +58 -44
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/handler.py +29 -27
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/ext/fastapi.py +1 -1
- {python_cq-0.11.0 → python_cq-0.11.1}/pyproject.toml +1 -1
- {python_cq-0.11.0 → python_cq-0.11.1}/.gitignore +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/LICENSE +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/README.md +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/__init__.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/__init__.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/dispatcher/__init__.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/dispatcher/base.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/dispatcher/bus.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/dispatcher/lazy.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/message.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/middleware.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/pipetools.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/related_events.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/_core/scope.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/exceptions.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/ext/__init__.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/middlewares/__init__.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/middlewares/retry.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/middlewares/scope.py +0 -0
- {python_cq-0.11.0 → python_cq-0.11.1}/cq/py.typed +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from collections import deque
|
|
2
2
|
from collections.abc import Awaitable, Callable
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
-
from typing import Any, Protocol, Self, overload
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Protocol, Self, overload
|
|
5
5
|
|
|
6
6
|
from cq._core.dispatcher.base import BaseDispatcher, Dispatcher
|
|
7
7
|
from cq._core.middleware import Middleware
|
|
@@ -34,23 +34,25 @@ class Pipe[I, O](BaseDispatcher[I, O]):
|
|
|
34
34
|
self.__dispatcher = dispatcher
|
|
35
35
|
self.__steps = []
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
38
|
+
|
|
39
|
+
@overload
|
|
40
|
+
def step[T](
|
|
41
|
+
self,
|
|
42
|
+
wrapped: PipeConverter[T, Any],
|
|
43
|
+
/,
|
|
44
|
+
*,
|
|
45
|
+
dispatcher: Dispatcher[T, Any] | None = ...,
|
|
46
|
+
) -> PipeConverter[T, Any]: ...
|
|
47
|
+
|
|
48
|
+
@overload
|
|
49
|
+
def step[T](
|
|
50
|
+
self,
|
|
51
|
+
wrapped: None = ...,
|
|
52
|
+
/,
|
|
53
|
+
*,
|
|
54
|
+
dispatcher: Dispatcher[T, Any] | None = ...,
|
|
55
|
+
) -> Callable[[PipeConverter[T, Any]], PipeConverter[T, Any]]: ...
|
|
54
56
|
|
|
55
57
|
def step[T](
|
|
56
58
|
self,
|
|
@@ -114,23 +116,33 @@ class ContextPipeline[I]:
|
|
|
114
116
|
self.__middlewares = deque()
|
|
115
117
|
self.__steps = []
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
instance: O,
|
|
121
|
-
owner: type[O] | None = ...,
|
|
122
|
-
) -> Dispatcher[I, O]: ...
|
|
119
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
120
|
+
|
|
121
|
+
@overload
|
|
122
|
+
def __get__[O](self, instance: None, owner: type[O], /) -> Dispatcher[I, O]: ...
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
@overload
|
|
125
|
+
def __get__[O](
|
|
126
|
+
self,
|
|
127
|
+
instance: O,
|
|
128
|
+
owner: type[O] | None = ...,
|
|
129
|
+
/,
|
|
130
|
+
) -> Dispatcher[I, O]: ...
|
|
131
|
+
|
|
132
|
+
@overload
|
|
133
|
+
def __get__(self, instance: None = ..., owner: None = ..., /) -> Self: ...
|
|
126
134
|
|
|
127
135
|
def __get__[O](
|
|
128
136
|
self,
|
|
129
137
|
instance: O | None = None,
|
|
130
138
|
owner: type[O] | None = None,
|
|
139
|
+
/,
|
|
131
140
|
) -> Self | Dispatcher[I, O]:
|
|
132
141
|
if instance is None:
|
|
133
|
-
|
|
142
|
+
if owner is None:
|
|
143
|
+
return self
|
|
144
|
+
|
|
145
|
+
instance = owner()
|
|
134
146
|
|
|
135
147
|
pipeline = self.__new_pipeline(instance, owner)
|
|
136
148
|
return BoundContextPipeline(instance, pipeline)
|
|
@@ -139,23 +151,25 @@ class ContextPipeline[I]:
|
|
|
139
151
|
self.__middlewares.extendleft(reversed(middlewares))
|
|
140
152
|
return self
|
|
141
153
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
155
|
+
|
|
156
|
+
@overload
|
|
157
|
+
def step[T](
|
|
158
|
+
self,
|
|
159
|
+
wrapped: PipeConverterMethod[T, Any],
|
|
160
|
+
/,
|
|
161
|
+
*,
|
|
162
|
+
dispatcher: Dispatcher[T, Any] | None = ...,
|
|
163
|
+
) -> PipeConverterMethod[T, Any]: ...
|
|
164
|
+
|
|
165
|
+
@overload
|
|
166
|
+
def step[T](
|
|
167
|
+
self,
|
|
168
|
+
wrapped: None = ...,
|
|
169
|
+
/,
|
|
170
|
+
*,
|
|
171
|
+
dispatcher: Dispatcher[T, Any] | None = ...,
|
|
172
|
+
) -> Callable[[PipeConverterMethod[T, Any]], PipeConverterMethod[T, Any]]: ...
|
|
159
173
|
|
|
160
174
|
def step[T](
|
|
161
175
|
self,
|
|
@@ -5,7 +5,7 @@ from dataclasses import dataclass, field
|
|
|
5
5
|
from functools import partial
|
|
6
6
|
from inspect import Parameter, getmro, isclass
|
|
7
7
|
from inspect import signature as inspect_signature
|
|
8
|
-
from typing import Any, Protocol, Self, overload, runtime_checkable
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Protocol, Self, overload, runtime_checkable
|
|
9
9
|
|
|
10
10
|
import injection
|
|
11
11
|
|
|
@@ -89,32 +89,34 @@ class HandlerDecorator[I, O]:
|
|
|
89
89
|
manager: HandlerManager[I, O]
|
|
90
90
|
injection_module: injection.Module = field(default_factory=injection.mod)
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
92
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
93
|
+
|
|
94
|
+
@overload
|
|
95
|
+
def __call__(
|
|
96
|
+
self,
|
|
97
|
+
input_or_handler_type: type[I],
|
|
98
|
+
/,
|
|
99
|
+
*,
|
|
100
|
+
threadsafe: bool | None = ...,
|
|
101
|
+
) -> Callable[[HandlerType[[I], O]], HandlerType[[I], O]]: ...
|
|
102
|
+
|
|
103
|
+
@overload
|
|
104
|
+
def __call__(
|
|
105
|
+
self,
|
|
106
|
+
input_or_handler_type: HandlerType[[I], O],
|
|
107
|
+
/,
|
|
108
|
+
*,
|
|
109
|
+
threadsafe: bool | None = ...,
|
|
110
|
+
) -> HandlerType[[I], O]: ...
|
|
111
|
+
|
|
112
|
+
@overload
|
|
113
|
+
def __call__(
|
|
114
|
+
self,
|
|
115
|
+
input_or_handler_type: None = ...,
|
|
116
|
+
/,
|
|
117
|
+
*,
|
|
118
|
+
threadsafe: bool | None = ...,
|
|
119
|
+
) -> Callable[[HandlerType[[I], O]], HandlerType[[I], O]]: ...
|
|
118
120
|
|
|
119
121
|
def __call__(
|
|
120
122
|
self,
|
|
@@ -53,7 +53,7 @@ async def new_deferred_query_bus[T](
|
|
|
53
53
|
return FastAPIDeferredDispatcher(background_tasks, query_bus)
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
if TYPE_CHECKING:
|
|
56
|
+
if TYPE_CHECKING: # pragma: no cover
|
|
57
57
|
type DeferredCommandBus = DeferredDispatcher[Command]
|
|
58
58
|
type DeferredEventBus = DeferredDispatcher[Event]
|
|
59
59
|
type DeferredQueryBus = DeferredDispatcher[Query]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|