@@ -90,7 +90,10 @@ async def __aiter__(self) -> AsyncIterator[_TCallable]:
9090 yield r
9191
9292 async def _notify (
93- self , * args : Any , callback_filter : Optional [Callable [[_TCallable ], bool ]] = None , ** kwargs : Any
93+ self ,
94+ * args : Any ,
95+ callback_filter : Optional [Callable [[_TCallable ], bool ]] = None ,
96+ ** kwargs : Any ,
9497 ) -> AsyncIterator [_TResult ]:
9598 for method in filter (
9699 lambda x : callback_filter (x ) if callback_filter is not None else True ,
@@ -118,7 +121,11 @@ async def __call__(self, *args: Any, **kwargs: Any) -> List[_TResult]:
118121
119122class AsyncEventDescriptorBase (Generic [_TCallable , _TResult , _TEvent ]):
120123 def __init__ (
121- self , _func : _TCallable , factory : Callable [..., _TEvent ], * factory_args : Any , ** factory_kwargs : Any
124+ self ,
125+ _func : _TCallable ,
126+ factory : Callable [..., _TEvent ],
127+ * factory_args : Any ,
128+ ** factory_kwargs : Any ,
122129 ) -> None :
123130 self ._func = _func
124131 self .__factory = factory
@@ -137,7 +144,11 @@ def __get__(self, obj: Any, objtype: Type[Any]) -> _TEvent:
137144
138145 name = f"__async_event_{ self ._func .__name__ } __"
139146 if not hasattr (obj , name ):
140- setattr (obj , name , self .__factory (* self .__factory_args , ** self .__factory_kwargs ))
147+ setattr (
148+ obj ,
149+ name ,
150+ self .__factory (* self .__factory_args , ** self .__factory_kwargs ),
151+ )
141152
142153 return cast ("_TEvent" , getattr (obj , name ))
143154
@@ -210,7 +221,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> AsyncIterator[Union[_TResult, B
210221 return self ._notify (* args , ** kwargs )
211222
212223
213- def _get_name_prefix (descriptor : AsyncEventDescriptorBase [Any , Any , Any ]) -> str :
224+ def _get_name_prefix (
225+ descriptor : AsyncEventDescriptorBase [Any , Any , Any ],
226+ ) -> str :
214227 if descriptor ._owner is None :
215228 return type (descriptor ).__qualname__
216229
@@ -227,13 +240,19 @@ class async_tasking_event_iterator( # noqa: N801
227240):
228241 def __init__ (self , _func : _TCallable ) -> None :
229242 super ().__init__ (
230- _func , AsyncTaskingEventIterator [_TCallable , Any ], task_name_prefix = lambda : _get_name_prefix (self )
243+ _func ,
244+ AsyncTaskingEventIterator [_TCallable , Any ],
245+ task_name_prefix = lambda : _get_name_prefix (self ),
231246 )
232247
233248
234249class async_tasking_event (AsyncEventDescriptorBase [_TCallable , Any , AsyncTaskingEvent [_TCallable , Any ]]): # noqa: N801
235250 def __init__ (self , _func : _TCallable ) -> None :
236- super ().__init__ (_func , AsyncTaskingEvent [_TCallable , Any ], task_name_prefix = lambda : _get_name_prefix (self ))
251+ super ().__init__ (
252+ _func ,
253+ AsyncTaskingEvent [_TCallable , Any ],
254+ task_name_prefix = lambda : _get_name_prefix (self ),
255+ )
237256
238257
239258async def check_canceled () -> bool :
@@ -418,7 +437,10 @@ async def __aenter__(self) -> None:
418437 await self .acquire ()
419438
420439 async def __aexit__ (
421- self , exc_type : Optional [Type [BaseException ]], exc_val : Optional [BaseException ], exc_tb : Optional [TracebackType ]
440+ self ,
441+ exc_type : Optional [Type [BaseException ]],
442+ exc_val : Optional [BaseException ],
443+ exc_tb : Optional [TracebackType ],
422444 ) -> None :
423445 self .release ()
424446
@@ -568,7 +590,10 @@ def get_current_future_info() -> Optional[FutureInfo]:
568590
569591
570592def create_sub_task (
571- coro : Coroutine [Any , Any , _T ], * , name : Optional [str ] = None , loop : Optional [asyncio .AbstractEventLoop ] = None
593+ coro : Coroutine [Any , Any , _T ],
594+ * ,
595+ name : Optional [str ] = None ,
596+ loop : Optional [asyncio .AbstractEventLoop ] = None ,
572597) -> asyncio .Task [_T ]:
573598 ct = get_current_future_info ()
574599
@@ -578,7 +603,9 @@ def create_sub_task(
578603 else :
579604
580605 async def create_task (
581- lo : asyncio .AbstractEventLoop , c : Coroutine [Any , Any , _T ], n : Optional [str ]
606+ lo : asyncio .AbstractEventLoop ,
607+ c : Coroutine [Any , Any , _T ],
608+ n : Optional [str ],
582609 ) -> asyncio .Task [_T ]:
583610 return create_sub_task (c , name = n , loop = lo )
584611
@@ -593,7 +620,9 @@ async def create_task(
593620 return result
594621
595622
596- def create_sub_future (loop : Optional [asyncio .AbstractEventLoop ] = None ) -> asyncio .Future [Any ]:
623+ def create_sub_future (
624+ loop : Optional [asyncio .AbstractEventLoop ] = None ,
625+ ) -> asyncio .Future [Any ]:
597626 ct = get_current_future_info ()
598627
599628 if loop is None :
0 commit comments