Skip to content

Commit 40bd21a

Browse files
committed
Add typing to callback function
1 parent 85c26b7 commit 40bd21a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

dash/_callback.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import collections
22
import hashlib
33
from functools import wraps
4-
from typing import Callable, Optional, Any
4+
from typing import Callable, Optional, Any, List, Tuple
55

66
import flask
77

88
from .dependencies import (
99
handle_callback_args,
1010
handle_grouped_callback_args,
1111
Output,
12+
Input,
1213
)
1314
from .exceptions import (
1415
InvalidCallbackReturnValue,
@@ -60,14 +61,14 @@ def is_no_update(obj):
6061
# pylint: disable=too-many-locals
6162
def callback(
6263
*_args,
63-
background=False,
64-
interval=1000,
65-
progress=None,
66-
progress_default=None,
67-
running=None,
68-
cancel=None,
69-
manager=None,
70-
cache_args_to_ignore=None,
64+
background: bool = False,
65+
interval: int = 1000,
66+
progress: Optional[Output] = None,
67+
progress_default: Any = None,
68+
running: Optional[List[Tuple[Output, Any, Any]]] = None,
69+
cancel: Optional[List[Input]] = None,
70+
manager: Optional[BaseLongCallbackManager] = None,
71+
cache_args_to_ignore: Optional[list] = None,
7172
on_error: Optional[Callable[[Exception], Any]] = None,
7273
**_kwargs,
7374
):
@@ -154,7 +155,7 @@ def callback(
154155
callback_list = _kwargs.pop("callback_list", GLOBAL_CALLBACK_LIST)
155156

156157
if background:
157-
long_spec = {
158+
long_spec: Any = {
158159
"interval": interval,
159160
}
160161

0 commit comments

Comments
 (0)