Skip to content

Commit 8822eef

Browse files
kloczekpre-commit-ci[bot]agoose77choldgraf
authored
really drop python<=3.8 support (#844)
* really drop python<=3.8 support Filter all code over `pyupgrade --py39-plus`. Signed-off-by: Tomasz Kłoczko <kloczek@github.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Tomasz Kłoczko <kloczek@github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Angus Hollands <goosey15@gmail.com> Co-authored-by: Chris Holdgraf <choldgraf@berkeley.edu>
1 parent 40f7c41 commit 8822eef

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

src/sphinx_book_theme/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ def update_mode_thebe_config(app):
140140
# but has not activated the sphinx_thebe extension.
141141
if not hasattr(app.env.config, "thebe_config"):
142142
SPHINX_LOGGER.warning(
143-
(
144-
"Thebe is activated but not added to extensions list. "
145-
"Add `sphinx_thebe` to your site's extensions list."
146-
)
143+
"Thebe is activated but not added to extensions list. "
144+
"Add `sphinx_thebe` to your site's extensions list."
147145
)
148146
return
149147
# Will be empty if it doesn't exist

src/sphinx_book_theme/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from docutils.nodes import Element
2-
from typing import Iterator
2+
from collections.abc import Iterator
33

44

55
def findall(node: Element, *args, **kwargs) -> Iterator[Element]:

src/sphinx_book_theme/header_buttons/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@ def update_context_with_repository_info(app):
174174
# If provider is still empty, raise an error because we don't recognize it
175175
if provider == "":
176176
raise SphinxError(
177-
(
178-
f"Provider not recognized in repository url {repo_url}. "
179-
"If you're using a custom provider URL, specify `repository_provider`"
180-
)
177+
f"Provider not recognized in repository url {repo_url}. "
178+
"If you're using a custom provider URL, specify `repository_provider`"
181179
)
182180

183181
# Update the context because this is what the get_edit_url function uses.

src/sphinx_book_theme/header_buttons/launch.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Launch buttons for Binder / Thebe / Colab / etc."""
22

33
from pathlib import Path
4-
from typing import Any, Dict, Optional
4+
from typing import Any, Optional
55
from urllib.parse import urlencode, quote
66

77
from docutils.nodes import document
@@ -23,7 +23,7 @@ def add_launch_buttons(
2323
app: Sphinx,
2424
pagename: str,
2525
templatename: str,
26-
context: Dict[str, Any],
26+
context: dict[str, Any],
2727
doctree: Optional[document],
2828
):
2929
"""Builds a binder link and inserts it in HTML context for use in templating.
@@ -89,11 +89,9 @@ def add_launch_buttons(
8989
notebook_interface = launch_buttons.get("notebook_interface", "classic")
9090
if notebook_interface not in notebook_interface_prefixes:
9191
raise ValueError(
92-
(
93-
"Notebook UI for Binder/JupyterHub links must be one"
94-
f"of {tuple(notebook_interface_prefixes.keys())},"
95-
f"not {notebook_interface}"
96-
)
92+
"Notebook UI for Binder/JupyterHub links must be one"
93+
f"of {tuple(notebook_interface_prefixes.keys())},"
94+
f"not {notebook_interface}"
9795
)
9896
ui_pre = notebook_interface_prefixes[notebook_interface]
9997

tests/test_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_build_book(sphinx_build_factory, file_regression):
8686
for filename, kernel in kernels_expected.items():
8787
ntbk_html = sphinx_build.html_tree("section1", filename)
8888
thebe_config = ntbk_html.find("script", attrs={"type": "text/x-thebe-config"})
89-
kernel_name = 'name: "{}",'.format(kernel)
89+
kernel_name = f'name: "{kernel}",'
9090
if kernel_name not in thebe_config.prettify():
9191
raise AssertionError(f"{kernel_name} not in {kernels_expected}")
9292

0 commit comments

Comments
 (0)