-
-
Notifications
You must be signed in to change notification settings - Fork 570
Fix type annotations for state session callbacks #8320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -782,7 +782,7 @@ def onload(self, callback: Callable[[], None | Coroutine[Any, Any, None]], threa | |||||
| else: | ||||||
| self._onload[self.curdoc] = [(callback, threaded)] | ||||||
|
|
||||||
| def on_session_created(self, callback: Callable[[SessionContext], None]) -> None: | ||||||
| def on_session_created(self, callback: Callable[[BokehSessionContext], None]) -> None: | ||||||
| """ | ||||||
| Callback that is triggered when a session is created. | ||||||
| """ | ||||||
|
|
@@ -795,7 +795,7 @@ def on_session_created(self, callback: Callable[[SessionContext], None]) -> None | |||||
| ) | ||||||
| self._on_session_created.append(callback) | ||||||
|
|
||||||
| def on_session_destroyed(self, callback: Callable[[SessionContext], None]) -> None: | ||||||
| def on_session_destroyed(self, callback: Callable[[BokehSessionContext], None]) -> None: | ||||||
|
||||||
| def on_session_destroyed(self, callback: Callable[[BokehSessionContext], None]) -> None: | |
| def on_session_destroyed(self, callback: Callable[[SessionContext], None]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type annotation change to
BokehSessionContextis inconsistent with the class variable_on_session_createdat line 187, which is typed aslist[Callable[[SessionContext], None]]. This creates a type incompatibility when appending callbacks at line 796. Additionally, internal callbacks like_initialize_session_info(line 167 in server.py) and_register_session_destroyed(line 501) useSessionContext, notBokehSessionContext.The class variables at lines 187-189 should also be updated to use
BokehSessionContextfor consistency, or ifSessionContextis the correct type, then this change should be reverted.