Skip to content

Commit 79dd52b

Browse files
committed
Remove comments and fix lints
1 parent 3df0026 commit 79dd52b

File tree

5 files changed

+6
-85
lines changed

5 files changed

+6
-85
lines changed

shiny/_app.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,7 @@ async def _on_root_request_cb(self, request: Request) -> Response:
387387
if callable(self.ui):
388388
ui = self._render_page(self.ui(request), self.lib_prefix)
389389
else:
390-
# TODO: Barret - Q: Why is this here as there's a with restore_context above?
391-
# TODO: Barret - Q: Why not `if restore_ctx.active:`?
392-
cur_restore_ctx = get_current_restore_context()
393-
print("cur_restore_ctx", cur_restore_ctx)
394-
if cur_restore_ctx is not None and cur_restore_ctx.active:
390+
if restore_ctx.active:
395391
# TODO: Barret - Docs: See ?enableBookmarking
396392
warnings.warn(
397393
"Trying to restore saved app state, but UI code must be a function for this to work!",

shiny/bookmark/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
ShinySaveState,
77
)
88
from ._button import input_bookmark_button
9-
from ._external import set_load_dir, set_save_dir
9+
from ._external import set_restore_dir, set_save_dir
1010
from ._restore_state import RestoreContext, RestoreContextState, restore_input
1111

1212
__all__ = (
@@ -20,7 +20,7 @@
2020
"input_bookmark_button",
2121
# _external
2222
"set_save_dir",
23-
"set_load_dir",
23+
"set_restore_dir",
2424
# _restore_state
2525
"RestoreContext",
2626
"RestoreContextState",

shiny/bookmark/_bookmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ async def _scoped_on_bookmark(self, root_state: ShinySaveState) -> None:
589589
)
590590

591591
# Make subdir for scope
592-
# TODO-barret; Is this for uploaded files?!?
592+
# TODO: Barret; Is this for uploaded files?!?
593593
if root_state.dir is not None:
594594
scope_subpath = self._ns
595595
scoped_state.dir = Path(root_state.dir) / scope_subpath

shiny/bookmark/_restore_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _state_within_namespace(self, prefix: str) -> "RestoreContextState":
5959
if self._name_has_namespace(name, prefix)
6060
}
6161

62-
# TODO-barret; Is this for bookmarking?!?
62+
# TODO: Barret; Is this for bookmarking?!?
6363
dir = self.dir
6464
if dir is not None:
6565
dir = dir / prefix

shiny/bookmark/_types.py

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,10 @@
33
from pathlib import Path
44
from typing import Awaitable, Callable, Literal
55

6-
# TODO: Barret: Q: Can we merge how bookmark dirs are saved / loaded?... it's the same directory! However, the save will return a possibly new path. Restoring will return an existing path.
6+
# Q: Can we merge how bookmark dirs are saved / loaded?... it's the same directory! However, the save will return a possibly new path. Restoring will return an existing path.
77
# A: No. Keep them separate. The save function may need to create a new directory, while the load function will always return an existing directory.
8-
9-
# TODO: Barret Rename load -> restore. Keep the names consistent!
108
GetBookmarkSaveDir = Callable[[str], Awaitable[Path]]
119
GetBookmarkRestoreDir = Callable[[str], Awaitable[Path]]
1210

1311

1412
BookmarkStore = Literal["url", "server", "disable"]
15-
16-
17-
# TODO: Barret; Q: I feel like there could be a `@shiny.globals.on_session_start` decorator that would allow us to set these values.
18-
19-
20-
# @shiny.session.on_session_start
21-
# def _(session): ...
22-
23-
24-
# @shiny.session.on_session_started
25-
# def _(session): ...
26-
27-
28-
# shiny.bookmark.globals.bookmark_save_dir = connect_custom_method
29-
# shiny.bookmark.globals.bookmark_load_dir = connect_custom_method
30-
31-
32-
# shiny.bookmark.set_bookmark_save_dir(connect_custom_method)
33-
# shiny.bookmark.set_bookmark_load_dir(connect_custom_method)
34-
35-
# ------------
36-
37-
# import shiny
38-
39-
# # Garrick like's this one... fix the name!
40-
# @shiny.bookmark.bookmark_save_dir
41-
# def connect_custom_method(id: str) -> Path:
42-
# return Path("connect") / id
43-
44-
45-
# shiny.run_app("some file")
46-
47-
# Using a decorator
48-
49-
50-
# from shiny.bookmark import _globals as bookmark_globals
51-
# bookmark_globals.bookmark_store = "url"
52-
53-
# bookmark.globals.bookmark_store = "url"
54-
55-
# import shiny
56-
57-
# TODO: Barret - Implement
58-
59-
# # Make placeholders start with underscore
60-
# shiny.bookmark.globals.bookmark_save_dir = connect_save_shiny_bookmark
61-
# shiny.bookmark.globals.bookmark_load_dir = connect_restore_shiny_bookmark
62-
63-
# # Implement this for now
64-
# # Hold off on
65-
66-
# # Global level
67-
# @shiny.bookmark.set_save_dir
68-
# def connect_save_shiny_bookmark(): ...
69-
70-
# Don't implement this
71-
# # App level
72-
# @app.bookmark.set_save_dir
73-
# def save_shiny_bookmark(): ...
74-
75-
76-
# @app.bookmark.set_save_dir
77-
# def save_shiny_bookmark(): ...
78-
79-
80-
# @shiny.bookmark.set_restore_dir
81-
# def connect_save_shiny_bookmark(): ...
82-
83-
84-
# VV Don't use the next line style. It must be in the App() object!
85-
# shiny.bookmark.globals.bookmark_store = "url"
86-
87-
# shiny.run_app("foo")

0 commit comments

Comments
 (0)