Skip to content

Commit 00481a4

Browse files
Simplify control flow
1 parent 0d4bc26 commit 00481a4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

jupyterlite_sphinx/jupyterlite_sphinx.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,14 @@ def run(self):
423423

424424
search_params = search_params_parser(self.options.pop("search_params", False))
425425

426-
new_tab = self.options.pop("new_tab", False)
427-
428426
# We first check the global config, and then the per-directive
429-
# option. It defaults to true for backwards compatibility.
430-
execute = self.options.pop("execute", None)
431-
if execute is None:
432-
execute = str(self.env.config.replite_auto_execute).lower()
433-
else:
434-
execute = execute.lower()
427+
# option. It defaults to True for backwards compatibility.
428+
execute = self.options.pop("execute", str(self.env.config.replite_auto_execute))
435429

436-
if execute == "false":
430+
if execute not in ("True", "False"):
431+
raise ValueError("The :execute: option must be either True or False")
432+
433+
if execute == "False":
437434
self.options["execute"] = "0"
438435

439436
content = self.content
@@ -445,6 +442,8 @@ def run(self):
445442
os.path.dirname(self.get_source_info()[0]),
446443
)
447444

445+
new_tab = self.options.pop("new_tab", False)
446+
448447
if new_tab:
449448
directive_button_text = self.options.pop("new_tab_button_text", None)
450449
if directive_button_text is not None:

0 commit comments

Comments
 (0)