python-redux 0.25.2__cp313-cp313-android_21_x86_64.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.
- python_redux-0.25.2.dist-info/METADATA +340 -0
- python_redux-0.25.2.dist-info/RECORD +30 -0
- python_redux-0.25.2.dist-info/WHEEL +5 -0
- python_redux-0.25.2.dist-info/licenses/LICENSE +201 -0
- python_redux-0.25.2.dist-info/top_level.txt +1 -0
- redux/__init__.c +5018 -0
- redux/__init__.cpython-313-x86_64-linux-android.so +0 -0
- redux/__init__.py +65 -0
- redux/autorun.c +19337 -0
- redux/autorun.cpython-313-x86_64-linux-android.so +0 -0
- redux/autorun.py +410 -0
- redux/basic_types.c +19301 -0
- redux/basic_types.cpython-313-x86_64-linux-android.so +0 -0
- redux/basic_types.py +514 -0
- redux/combine_reducers.c +11828 -0
- redux/combine_reducers.cpython-313-x86_64-linux-android.so +0 -0
- redux/combine_reducers.py +160 -0
- redux/main.c +22250 -0
- redux/main.cpython-313-x86_64-linux-android.so +0 -0
- redux/main.py +473 -0
- redux/py.typed +1 -0
- redux/serialization_mixin.c +9331 -0
- redux/serialization_mixin.cpython-313-x86_64-linux-android.so +0 -0
- redux/serialization_mixin.py +44 -0
- redux/side_effect_runner.c +13641 -0
- redux/side_effect_runner.cpython-313-x86_64-linux-android.so +0 -0
- redux/side_effect_runner.py +87 -0
- redux/utils.c +9301 -0
- redux/utils.cpython-313-x86_64-linux-android.so +0 -0
- redux/utils.py +49 -0
|
Binary file
|
redux/basic_types.py
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
# ruff: noqa: D100, D101, D102, D103, D107
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from collections.abc import Awaitable, Callable, Coroutine, Sequence
|
|
5
|
+
from dataclasses import field
|
|
6
|
+
from types import NoneType
|
|
7
|
+
from typing import (
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Concatenate,
|
|
11
|
+
Generic,
|
|
12
|
+
Literal,
|
|
13
|
+
ParamSpec,
|
|
14
|
+
Protocol,
|
|
15
|
+
TypeAlias,
|
|
16
|
+
TypeGuard,
|
|
17
|
+
cast,
|
|
18
|
+
overload,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
from immutable import Immutable
|
|
22
|
+
from typing_extensions import TypeVar
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from asyncio import Task
|
|
26
|
+
|
|
27
|
+
from redux.autorun import Autorun
|
|
28
|
+
from redux.side_effect_runner import SideEffectRunner
|
|
29
|
+
|
|
30
|
+
T = TypeVar('T')
|
|
31
|
+
|
|
32
|
+
AwaitableOrNot = Awaitable[T] | T
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class BaseAction(Immutable): ...
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BaseEvent(Immutable): ...
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class InitAction(BaseAction): ...
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class FinishAction(BaseAction): ...
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FinishEvent(BaseEvent): ...
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# Type variables
|
|
51
|
+
State = TypeVar('State', bound=Immutable | None, infer_variance=True)
|
|
52
|
+
Action = TypeVar('Action', bound=BaseAction | None, infer_variance=True)
|
|
53
|
+
Event = TypeVar('Event', bound=BaseEvent | None, infer_variance=True)
|
|
54
|
+
StrictEvent = TypeVar('StrictEvent', bound=BaseEvent, infer_variance=True)
|
|
55
|
+
SelectorOutput = TypeVar('SelectorOutput', infer_variance=True)
|
|
56
|
+
ComparatorOutput = TypeVar('ComparatorOutput', infer_variance=True)
|
|
57
|
+
ReturnType = TypeVar('ReturnType', infer_variance=True)
|
|
58
|
+
Comparator = Callable[[State], ComparatorOutput]
|
|
59
|
+
EventHandler: TypeAlias = Callable[[Event], Any] | Callable[[], Any]
|
|
60
|
+
Args = ParamSpec('Args')
|
|
61
|
+
Payload = TypeVar('Payload', bound=Any, default=None)
|
|
62
|
+
MethodSelf = TypeVar('MethodSelf', bound=object, infer_variance=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class CompleteReducerResult(Immutable, Generic[State, Action, Event]):
|
|
66
|
+
state: State
|
|
67
|
+
actions: Sequence[Action] | None = None
|
|
68
|
+
events: Sequence[Event] | None = None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
ReducerResult: TypeAlias = CompleteReducerResult[State, Action, Event] | State
|
|
72
|
+
ReducerType: TypeAlias = Callable[
|
|
73
|
+
[State | None, Action],
|
|
74
|
+
ReducerResult[State, Action, Event],
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class InitializationActionError(Exception):
|
|
79
|
+
def __init__(self: InitializationActionError, action: BaseAction) -> None:
|
|
80
|
+
super().__init__(
|
|
81
|
+
f"""The only accepted action type when state is None is "InitAction", \
|
|
82
|
+
action "{action}" is not allowed.""",
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def is_complete_reducer_result(
|
|
87
|
+
result: ReducerResult[State, Action, Event],
|
|
88
|
+
) -> TypeGuard[CompleteReducerResult[State, Action, Event]]:
|
|
89
|
+
return isinstance(result, CompleteReducerResult)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def is_state_reducer_result(
|
|
93
|
+
result: ReducerResult[State, Action, Event],
|
|
94
|
+
) -> TypeGuard[State]:
|
|
95
|
+
return not isinstance(result, CompleteReducerResult)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class Scheduler(Protocol):
|
|
99
|
+
def __call__(self: Scheduler, callback: Callable, *, interval: bool) -> None: ...
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TaskCreatorCallback(Protocol):
|
|
103
|
+
def __call__(self: TaskCreatorCallback, task: Task) -> None: ...
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class TaskCreator(Protocol):
|
|
107
|
+
def __call__(
|
|
108
|
+
self: TaskCreator,
|
|
109
|
+
coro: Coroutine,
|
|
110
|
+
) -> None: ...
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ActionMiddleware(Protocol, Generic[Action]):
|
|
114
|
+
def __call__(self: ActionMiddleware, action: Action) -> Action | None: ...
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class EventMiddleware(Protocol, Generic[Event]):
|
|
118
|
+
def __call__(self: EventMiddleware, event: Event) -> Event | None: ...
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class StoreOptions(Immutable, Generic[Action, Event]):
|
|
122
|
+
auto_init: bool = False
|
|
123
|
+
side_effect_threads: int = 1
|
|
124
|
+
scheduler: Scheduler | None = None
|
|
125
|
+
action_middlewares: Sequence[ActionMiddleware[Action | InitAction]] = field(
|
|
126
|
+
default_factory=list,
|
|
127
|
+
)
|
|
128
|
+
event_middlewares: Sequence[EventMiddleware[Event | FinishEvent]] = field(
|
|
129
|
+
default_factory=list,
|
|
130
|
+
)
|
|
131
|
+
task_creator: TaskCreator | None = None
|
|
132
|
+
on_finish: Callable[[], Any] | None = None
|
|
133
|
+
grace_time_in_seconds: float = 1
|
|
134
|
+
autorun_class: type[Autorun] = field(
|
|
135
|
+
default_factory=lambda: __import__(
|
|
136
|
+
'redux.autorun',
|
|
137
|
+
fromlist=['redux'],
|
|
138
|
+
).Autorun,
|
|
139
|
+
)
|
|
140
|
+
side_effect_runner_class: type[SideEffectRunner] = field(
|
|
141
|
+
default_factory=lambda: __import__(
|
|
142
|
+
'redux.side_effect_runner',
|
|
143
|
+
fromlist=['redux'],
|
|
144
|
+
).SideEffectRunner,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# Autorun
|
|
149
|
+
|
|
150
|
+
AutoAwait = TypeVar(
|
|
151
|
+
'AutoAwait',
|
|
152
|
+
bound=(Literal[True, False] | None),
|
|
153
|
+
infer_variance=True,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
NOT_SET = object()
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AutorunOptionsType(Immutable, Generic[ReturnType, AutoAwait]):
|
|
160
|
+
default_value: ReturnType | None = None
|
|
161
|
+
auto_await: AutoAwait = cast('AutoAwait', val=None)
|
|
162
|
+
initial_call: bool = True
|
|
163
|
+
reactive: bool = True
|
|
164
|
+
memoization: bool = True
|
|
165
|
+
keep_ref: bool = True
|
|
166
|
+
subscribers_initial_run: bool = True
|
|
167
|
+
subscribers_keep_ref: bool = True
|
|
168
|
+
|
|
169
|
+
@overload
|
|
170
|
+
def __init__(
|
|
171
|
+
self: AutorunOptionsType[ReturnType, None], # type: ignore[reportInvalidTypeVar]
|
|
172
|
+
*,
|
|
173
|
+
default_value: ReturnType | None = None,
|
|
174
|
+
auto_await: None = None,
|
|
175
|
+
initial_call: bool = True,
|
|
176
|
+
reactive: bool = True,
|
|
177
|
+
memoization: bool = True,
|
|
178
|
+
keep_ref: bool = True,
|
|
179
|
+
subscribers_initial_run: bool = True,
|
|
180
|
+
subscribers_keep_ref: bool = True,
|
|
181
|
+
) -> None: ...
|
|
182
|
+
@overload
|
|
183
|
+
def __init__(
|
|
184
|
+
self: AutorunOptionsType[ReturnType, Literal[True]], # type: ignore[reportInvalidTypeVar]
|
|
185
|
+
*,
|
|
186
|
+
default_value: ReturnType | None = None,
|
|
187
|
+
auto_await: Literal[True],
|
|
188
|
+
initial_call: bool = True,
|
|
189
|
+
reactive: bool = True,
|
|
190
|
+
memoization: bool = True,
|
|
191
|
+
keep_ref: bool = True,
|
|
192
|
+
subscribers_initial_run: bool = True,
|
|
193
|
+
subscribers_keep_ref: bool = True,
|
|
194
|
+
) -> None: ...
|
|
195
|
+
@overload
|
|
196
|
+
def __init__(
|
|
197
|
+
self: AutorunOptionsType[ReturnType, Literal[False]], # type: ignore[reportInvalidTypeVar]
|
|
198
|
+
*,
|
|
199
|
+
default_value: ReturnType | None = None,
|
|
200
|
+
auto_await: Literal[False],
|
|
201
|
+
initial_call: bool = True,
|
|
202
|
+
reactive: bool = True,
|
|
203
|
+
memoization: bool = True,
|
|
204
|
+
keep_ref: bool = True,
|
|
205
|
+
subscribers_initial_run: bool = True,
|
|
206
|
+
subscribers_keep_ref: bool = True,
|
|
207
|
+
) -> None: ...
|
|
208
|
+
def __init__( # noqa: PLR0913
|
|
209
|
+
self: AutorunOptionsType,
|
|
210
|
+
*,
|
|
211
|
+
default_value: ReturnType | None = None,
|
|
212
|
+
auto_await: bool | None = None,
|
|
213
|
+
initial_call: bool = True,
|
|
214
|
+
reactive: bool = True,
|
|
215
|
+
memoization: bool = True,
|
|
216
|
+
keep_ref: bool = True,
|
|
217
|
+
subscribers_initial_run: bool = True,
|
|
218
|
+
subscribers_keep_ref: bool = True,
|
|
219
|
+
) -> None: ...
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class AutorunOptionsImplementation(Immutable, Generic[ReturnType, AutoAwait]):
|
|
223
|
+
default_value: ReturnType | None = cast('None', NOT_SET)
|
|
224
|
+
auto_await: AutoAwait = cast('AutoAwait', val=None)
|
|
225
|
+
initial_call: bool = True
|
|
226
|
+
reactive: bool = True
|
|
227
|
+
memoization: bool = True
|
|
228
|
+
keep_ref: bool = True
|
|
229
|
+
subscribers_initial_run: bool = True
|
|
230
|
+
subscribers_keep_ref: bool = True
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
AutorunOptions = cast('type[AutorunOptionsType]', AutorunOptionsImplementation)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
class AutorunReturnType(
|
|
237
|
+
Protocol,
|
|
238
|
+
Generic[Args, ReturnType],
|
|
239
|
+
):
|
|
240
|
+
def __call__(
|
|
241
|
+
self: AutorunReturnType,
|
|
242
|
+
*args: Args.args,
|
|
243
|
+
**kwargs: Args.kwargs,
|
|
244
|
+
) -> ReturnType: ...
|
|
245
|
+
|
|
246
|
+
@property
|
|
247
|
+
def value(self: AutorunReturnType) -> ReturnType: ...
|
|
248
|
+
|
|
249
|
+
def subscribe(
|
|
250
|
+
self: AutorunReturnType,
|
|
251
|
+
callback: Callable[[ReturnType], Any],
|
|
252
|
+
*,
|
|
253
|
+
initial_run: bool | None = None,
|
|
254
|
+
keep_ref: bool | None = None,
|
|
255
|
+
) -> Callable[[], None]: ...
|
|
256
|
+
|
|
257
|
+
def unsubscribe(self: AutorunReturnType) -> None: ...
|
|
258
|
+
|
|
259
|
+
__name__: str
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
class MethodAutorunReturnType(
|
|
263
|
+
AutorunReturnType,
|
|
264
|
+
Protocol,
|
|
265
|
+
Generic[MethodSelf, Args, ReturnType],
|
|
266
|
+
):
|
|
267
|
+
def __call__(
|
|
268
|
+
self: AutorunReturnType,
|
|
269
|
+
self_: MethodSelf,
|
|
270
|
+
*args: Args.args,
|
|
271
|
+
**kwargs: Args.kwargs,
|
|
272
|
+
) -> ReturnType: ...
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class AutorunDecorator(Protocol, Generic[ReturnType, SelectorOutput, AutoAwait]):
|
|
276
|
+
@overload
|
|
277
|
+
def __call__(
|
|
278
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
|
|
279
|
+
func: Callable[Concatenate[SelectorOutput, Args], Awaitable[ReturnType]],
|
|
280
|
+
) -> AutorunReturnType[Args, None]: ...
|
|
281
|
+
@overload
|
|
282
|
+
def __call__(
|
|
283
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
|
|
284
|
+
func: Callable[
|
|
285
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
286
|
+
Awaitable[ReturnType],
|
|
287
|
+
],
|
|
288
|
+
) -> MethodAutorunReturnType[MethodSelf, Args, None]: ...
|
|
289
|
+
|
|
290
|
+
@overload
|
|
291
|
+
def __call__(
|
|
292
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
|
|
293
|
+
func: Callable[
|
|
294
|
+
Concatenate[SelectorOutput, Args],
|
|
295
|
+
ReturnType,
|
|
296
|
+
],
|
|
297
|
+
) -> AutorunReturnType[Args, ReturnType]: ...
|
|
298
|
+
@overload
|
|
299
|
+
def __call__(
|
|
300
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
|
|
301
|
+
func: Callable[
|
|
302
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
303
|
+
ReturnType,
|
|
304
|
+
],
|
|
305
|
+
) -> MethodAutorunReturnType[MethodSelf, Args, ReturnType]: ...
|
|
306
|
+
|
|
307
|
+
@overload
|
|
308
|
+
def __call__(
|
|
309
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[True]],
|
|
310
|
+
func: Callable[
|
|
311
|
+
Concatenate[SelectorOutput, Args],
|
|
312
|
+
Awaitable[ReturnType],
|
|
313
|
+
],
|
|
314
|
+
) -> AutorunReturnType[Args, None]: ...
|
|
315
|
+
@overload
|
|
316
|
+
def __call__(
|
|
317
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[True]],
|
|
318
|
+
func: Callable[
|
|
319
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
320
|
+
Awaitable[ReturnType],
|
|
321
|
+
],
|
|
322
|
+
) -> MethodAutorunReturnType[MethodSelf, Args, None]: ...
|
|
323
|
+
|
|
324
|
+
@overload
|
|
325
|
+
def __call__(
|
|
326
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[False]],
|
|
327
|
+
func: Callable[
|
|
328
|
+
Concatenate[SelectorOutput, Args],
|
|
329
|
+
Awaitable[ReturnType],
|
|
330
|
+
],
|
|
331
|
+
) -> AutorunReturnType[Args, Awaitable[ReturnType]]: ...
|
|
332
|
+
@overload
|
|
333
|
+
def __call__(
|
|
334
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[False]],
|
|
335
|
+
func: Callable[
|
|
336
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
337
|
+
Awaitable[ReturnType],
|
|
338
|
+
],
|
|
339
|
+
) -> MethodAutorunReturnType[MethodSelf, Args, Awaitable[ReturnType]]: ...
|
|
340
|
+
|
|
341
|
+
@overload
|
|
342
|
+
def __call__(
|
|
343
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, bool],
|
|
344
|
+
func: Callable[
|
|
345
|
+
Concatenate[SelectorOutput, Args],
|
|
346
|
+
ReturnType,
|
|
347
|
+
],
|
|
348
|
+
) -> AutorunReturnType[Args, ReturnType]: ...
|
|
349
|
+
@overload
|
|
350
|
+
def __call__(
|
|
351
|
+
self: AutorunDecorator[ReturnType, SelectorOutput, bool],
|
|
352
|
+
func: Callable[
|
|
353
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
354
|
+
ReturnType,
|
|
355
|
+
],
|
|
356
|
+
) -> MethodAutorunReturnType[MethodSelf, Args, ReturnType]: ...
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
# View
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class ViewOptions(Immutable, Generic[ReturnType]):
|
|
363
|
+
default_value: ReturnType | None = None
|
|
364
|
+
memoization: bool = True
|
|
365
|
+
keep_ref: bool = True
|
|
366
|
+
subscribers_initial_run: bool = True
|
|
367
|
+
subscribers_keep_ref: bool = True
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class ViewReturnType(
|
|
371
|
+
Protocol,
|
|
372
|
+
Generic[ReturnType, Args],
|
|
373
|
+
):
|
|
374
|
+
def __call__(
|
|
375
|
+
self: ViewReturnType,
|
|
376
|
+
*args: Args.args,
|
|
377
|
+
**kwargs: Args.kwargs,
|
|
378
|
+
) -> ReturnType: ...
|
|
379
|
+
|
|
380
|
+
@property
|
|
381
|
+
def value(self: ViewReturnType) -> ReturnType: ...
|
|
382
|
+
|
|
383
|
+
def subscribe(
|
|
384
|
+
self: ViewReturnType,
|
|
385
|
+
callback: Callable[[ReturnType], Any],
|
|
386
|
+
*,
|
|
387
|
+
initial_run: bool | None = None,
|
|
388
|
+
keep_ref: bool | None = None,
|
|
389
|
+
) -> Callable[[], None]: ...
|
|
390
|
+
|
|
391
|
+
def unsubscribe(self: ViewReturnType) -> None: ...
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
class ViewDecorator(
|
|
395
|
+
Protocol,
|
|
396
|
+
Generic[ReturnType, SelectorOutput],
|
|
397
|
+
):
|
|
398
|
+
@overload
|
|
399
|
+
def __call__(
|
|
400
|
+
self: ViewDecorator,
|
|
401
|
+
func: Callable[
|
|
402
|
+
Concatenate[SelectorOutput, Args],
|
|
403
|
+
Awaitable[ReturnType],
|
|
404
|
+
],
|
|
405
|
+
) -> ViewReturnType[Awaitable[ReturnType], Args]: ...
|
|
406
|
+
@overload
|
|
407
|
+
def __call__(
|
|
408
|
+
self: ViewDecorator,
|
|
409
|
+
func: Callable[
|
|
410
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
411
|
+
Awaitable[ReturnType],
|
|
412
|
+
],
|
|
413
|
+
) -> ViewReturnType[Awaitable[ReturnType], Args]: ...
|
|
414
|
+
|
|
415
|
+
@overload
|
|
416
|
+
def __call__(
|
|
417
|
+
self: ViewDecorator,
|
|
418
|
+
func: Callable[
|
|
419
|
+
Concatenate[SelectorOutput, Args],
|
|
420
|
+
ReturnType,
|
|
421
|
+
],
|
|
422
|
+
) -> ViewReturnType[ReturnType, Args]: ...
|
|
423
|
+
@overload
|
|
424
|
+
def __call__(
|
|
425
|
+
self: ViewDecorator,
|
|
426
|
+
func: Callable[
|
|
427
|
+
Concatenate[MethodSelf, SelectorOutput, Args],
|
|
428
|
+
ReturnType,
|
|
429
|
+
],
|
|
430
|
+
) -> ViewReturnType[ReturnType, Args]: ...
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
# With Store
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class WithStateDecorator(
|
|
437
|
+
Protocol,
|
|
438
|
+
Generic[SelectorOutput],
|
|
439
|
+
):
|
|
440
|
+
@overload
|
|
441
|
+
def __call__(
|
|
442
|
+
self: WithStateDecorator,
|
|
443
|
+
func: Callable[Concatenate[SelectorOutput, Args], ReturnType],
|
|
444
|
+
) -> Callable[Args, ReturnType]: ...
|
|
445
|
+
|
|
446
|
+
@overload
|
|
447
|
+
def __call__(
|
|
448
|
+
self: WithStateDecorator,
|
|
449
|
+
func: Callable[Concatenate[MethodSelf, SelectorOutput, Args], ReturnType],
|
|
450
|
+
) -> Callable[Concatenate[MethodSelf, Args], ReturnType]: ...
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class EventSubscriber(Protocol):
|
|
454
|
+
def __call__(
|
|
455
|
+
self: EventSubscriber,
|
|
456
|
+
event_type: type[Event],
|
|
457
|
+
handler: EventHandler[Event],
|
|
458
|
+
*,
|
|
459
|
+
keep_ref: bool = True,
|
|
460
|
+
) -> Callable[[], None]: ...
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
DispatchParameters: TypeAlias = Action | InitAction | list[Action | InitAction]
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class Dispatch(Protocol, Generic[State, Action, Event]):
|
|
467
|
+
def __call__(
|
|
468
|
+
self: Dispatch,
|
|
469
|
+
*items: Action | Event | list[Action | Event],
|
|
470
|
+
with_state: Callable[[State | None], Action | Event | list[Action | Event]]
|
|
471
|
+
| None = None,
|
|
472
|
+
) -> None: ...
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
class BaseCombineReducerState(Immutable):
|
|
476
|
+
combine_reducers_id: str
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
class CombineReducerAction(BaseAction):
|
|
480
|
+
combine_reducers_id: str
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class CombineReducerInitAction(CombineReducerAction, InitAction, Generic[Payload]):
|
|
484
|
+
key: str
|
|
485
|
+
payload: Payload | None = None
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class CombineReducerRegisterAction(CombineReducerAction, Generic[Payload]):
|
|
489
|
+
key: str
|
|
490
|
+
reducer: ReducerType
|
|
491
|
+
payload: Payload | None = None
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
class CombineReducerUnregisterAction(CombineReducerAction):
|
|
495
|
+
key: str
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
SnapshotAtom = (
|
|
499
|
+
int
|
|
500
|
+
| float
|
|
501
|
+
| str
|
|
502
|
+
| bool
|
|
503
|
+
| NoneType
|
|
504
|
+
| dict[str, 'SnapshotAtom']
|
|
505
|
+
| list['SnapshotAtom']
|
|
506
|
+
)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
class SubscribeEventCleanup(Immutable, Generic[StrictEvent]):
|
|
510
|
+
unsubscribe: Callable[[], None]
|
|
511
|
+
handler: EventHandler[StrictEvent]
|
|
512
|
+
|
|
513
|
+
def __call__(self: SubscribeEventCleanup) -> None:
|
|
514
|
+
self.unsubscribe()
|