Daniel Brötzmann pushed to branch module-type-annotations at gajim / gajim


Commits:
5ae15cfe by wurstsalat at 2023-06-15T11:22:56+02:00
cq: Util module: Add type annotations for as_task

- - - - -


1 changed file:

- gajim/common/modules/util.py


Changes:

=====================================
gajim/common/modules/util.py
=====================================
@@ -19,6 +19,7 @@
 from typing import Any
 
 import logging
+from collections.abc import Callable
 from functools import partial
 from functools import wraps
 from logging import LoggerAdapter
@@ -109,14 +110,14 @@ def process(self, msg: str, kwargs: Any) -> tuple[str, 
Any]:
         return f'({self.extra["account"]}) {msg}', kwargs
 
 
-def as_task(func):
+def as_task(func: Any) -> Any:
     @wraps(func)
-    def func_wrapper(self,
-                     *args,
-                     timeout=None,
-                     callback=None,
-                     user_data=None,
-                     **kwargs):
+    def func_wrapper(self: Any,
+                     *args: Any,
+                     timeout: int | None =None,
+                     callback: Callable[..., Any] | None = None,
+                     user_data: Any = None,
+                     **kwargs: Any):
 
         task_ = Task(func(self, *args, **kwargs))
         task_.set_timeout(timeout)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5ae15cfe3ec3833d06d8529b3ca3397aeb36d12a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/5ae15cfe3ec3833d06d8529b3ca3397aeb36d12a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to