Skip to content

Commit 0067221

Browse files
committed
Use int instead of str for callback keys
1 parent 9eb5951 commit 0067221

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

shiny/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ def drop_none(x: Dict[str, Any]) -> Dict[str, object]:
116116

117117
class Callbacks:
118118
def __init__(self) -> None:
119-
self._callbacks: dict[str, Tuple[Callable[[], None], bool]] = {}
119+
self._callbacks: dict[int, Tuple[Callable[[], None], bool]] = {}
120120
self._id: int = 0
121121

122122
def register(
123123
self, fn: Callable[[], None], once: bool = False
124124
) -> Callable[[], None]:
125125
self._id += 1
126-
id = str(self._id)
126+
id = self._id
127127
self._callbacks[id] = (fn, once)
128128

129129
def _():
@@ -151,14 +151,14 @@ def count(self) -> int:
151151

152152
class AsyncCallbacks:
153153
def __init__(self) -> None:
154-
self._callbacks: dict[str, Tuple[Callable[[], Awaitable[None]], bool]] = {}
154+
self._callbacks: dict[int, Tuple[Callable[[], Awaitable[None]], bool]] = {}
155155
self._id: int = 0
156156

157157
def register(
158158
self, fn: Callable[[], Awaitable[None]], once: bool = False
159159
) -> Callable[[], None]:
160160
self._id += 1
161-
id = str(self._id)
161+
id = self._id
162162
self._callbacks[id] = (fn, once)
163163

164164
def _():

0 commit comments

Comments
 (0)