From 324cc28fe4923acc42fbb33a0f2217d9fecf1219 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 7 Feb 2024 12:13:58 +0000 Subject: [PATCH] refactor: handle options more pythonically --- src/sphinx_book_theme/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sphinx_book_theme/__init__.py b/src/sphinx_book_theme/__init__.py index da9e7498..9589d454 100644 --- a/src/sphinx_book_theme/__init__.py +++ b/src/sphinx_book_theme/__init__.py @@ -133,7 +133,7 @@ def hash_html_assets(app, pagename, templatename, context, doctree): def update_mode_thebe_config(app): """Update thebe configuration with SBT-specific values""" theme_options = get_theme_options_dict(app) - if theme_options.get("launch_buttons", {}).get("thebe") is True: + if theme_options.get("launch_buttons", {}).get("thebe"): # In case somebody specifies they want thebe in a launch button # but has not activated the sphinx_thebe extension. if not hasattr(app.env.config, "thebe_config"): @@ -149,9 +149,6 @@ def update_mode_thebe_config(app): else: return - if not theme_options.get("launch_buttons", {}).get("thebe"): - return - # Update the repository branch and URL # Assume that if there's already a thebe_config, then we don't want to over-ride if "repository_url" not in thebe_config: