1- # ruff: noqa: A003, D100, D101, D102, D103, D104, D105 , D107
1+ # ruff: noqa: D100, D101, D102, D103, D107
22from __future__ import annotations
33
44from collections .abc import Awaitable , Callable , Coroutine , Sequence
@@ -118,18 +118,6 @@ class EventMiddleware(Protocol, Generic[Event]):
118118 def __call__ (self : EventMiddleware , event : Event ) -> Event | None : ...
119119
120120
121- def default_autorun () -> type [Autorun ]:
122- from redux .autorun import Autorun
123-
124- return Autorun
125-
126-
127- def default_side_effect_runner () -> type [SideEffectRunner ]:
128- from redux .side_effect_runner import SideEffectRunner
129-
130- return SideEffectRunner
131-
132-
133121class StoreOptions (Immutable , Generic [Action , Event ]):
134122 auto_init : bool = False
135123 side_effect_threads : int = 1
@@ -143,15 +131,27 @@ class StoreOptions(Immutable, Generic[Action, Event]):
143131 task_creator : TaskCreator | None = None
144132 on_finish : Callable [[], Any ] | None = None
145133 grace_time_in_seconds : float = 1
146- autorun_class : type [Autorun ] = field (default_factory = default_autorun )
134+ autorun_class : type [Autorun ] = field (
135+ default_factory = lambda : __import__ (
136+ 'redux.autorun' ,
137+ fromlist = ['redux' ],
138+ ).Autorun ,
139+ )
147140 side_effect_runner_class : type [SideEffectRunner ] = field (
148- default_factory = default_side_effect_runner ,
141+ default_factory = lambda : __import__ (
142+ 'redux.side_effect_runner' ,
143+ fromlist = ['redux' ],
144+ ).SideEffectRunner ,
149145 )
150146
151147
152148# Autorun
153149
154- AutoAwait = TypeVar ('AutoAwait' , bound = Literal [True , False , None ], infer_variance = True )
150+ AutoAwait = TypeVar (
151+ 'AutoAwait' ,
152+ bound = (Literal [True , False ] | None ),
153+ infer_variance = True ,
154+ )
155155
156156NOT_SET = object ()
157157
@@ -168,10 +168,10 @@ class AutorunOptionsType(Immutable, Generic[ReturnType, AutoAwait]):
168168
169169 @overload
170170 def __init__ (
171- self : AutorunOptionsType [ReturnType , Literal [ None ] ], # type: ignore[reportInvalidTypeVar]
171+ self : AutorunOptionsType [ReturnType , None ], # type: ignore[reportInvalidTypeVar]
172172 * ,
173173 default_value : ReturnType | None = None ,
174- auto_await : Literal [ None ] | None = None ,
174+ auto_await : None = None ,
175175 initial_call : bool = True ,
176176 reactive : bool = True ,
177177 memoization : bool = True ,
@@ -275,12 +275,12 @@ def __call__(
275275class AutorunDecorator (Protocol , Generic [ReturnType , SelectorOutput , AutoAwait ]):
276276 @overload
277277 def __call__ (
278- self : AutorunDecorator [ReturnType , SelectorOutput , Literal [ None ] ],
278+ self : AutorunDecorator [ReturnType , SelectorOutput , None ],
279279 func : Callable [Concatenate [SelectorOutput , Args ], Awaitable [ReturnType ]],
280280 ) -> AutorunReturnType [Args , None ]: ...
281281 @overload
282282 def __call__ (
283- self : AutorunDecorator [ReturnType , SelectorOutput , Literal [ None ] ],
283+ self : AutorunDecorator [ReturnType , SelectorOutput , None ],
284284 func : Callable [
285285 Concatenate [MethodSelf , SelectorOutput , Args ],
286286 Awaitable [ReturnType ],
@@ -289,15 +289,15 @@ def __call__(
289289
290290 @overload
291291 def __call__ (
292- self : AutorunDecorator [ReturnType , SelectorOutput , Literal [ None ] ],
292+ self : AutorunDecorator [ReturnType , SelectorOutput , None ],
293293 func : Callable [
294294 Concatenate [SelectorOutput , Args ],
295295 ReturnType ,
296296 ],
297297 ) -> AutorunReturnType [Args , ReturnType ]: ...
298298 @overload
299299 def __call__ (
300- self : AutorunDecorator [ReturnType , SelectorOutput , Literal [ None ] ],
300+ self : AutorunDecorator [ReturnType , SelectorOutput , None ],
301301 func : Callable [
302302 Concatenate [MethodSelf , SelectorOutput , Args ],
303303 ReturnType ,
0 commit comments