From 86bc27b7a3ddcaf0b73f6a898f0cf8e5256a9b2c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:48:22 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/st_pages/__init__.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/st_pages/__init__.py b/src/st_pages/__init__.py index ab07a91..36e65ef 100644 --- a/src/st_pages/__init__.py +++ b/src/st_pages/__init__.py @@ -39,7 +39,7 @@ def translate_icon(icon: str | None) -> str | None: def _get_nav_from_toml( - path: str = ".streamlit/pages.toml", + path: str = ".streamlit/pages.toml", ) -> list[StreamlitPage] | dict[str, list[StreamlitPage]]: """ Given a path to a TOML file, return a list or dictionary that can be passed to @@ -57,8 +57,8 @@ def _get_nav_from_toml( p for p in pages if ( - p.name not in st.session_state[HIDE_PAGES_KEY] - and str(p.name).replace("_", " ") not in st.session_state[HIDE_PAGES_KEY] + p.name not in st.session_state[HIDE_PAGES_KEY] + and str(p.name).replace("_", " ") not in st.session_state[HIDE_PAGES_KEY] ) or p.is_section ] @@ -117,8 +117,8 @@ def _get_nav_from_toml( def _hide_pages(pages: list[str]): if ( - HIDE_PAGES_KEY not in st.session_state - or st.session_state[HIDE_PAGES_KEY] != pages + HIDE_PAGES_KEY not in st.session_state + or st.session_state[HIDE_PAGES_KEY] != pages ): st.session_state[HIDE_PAGES_KEY] = pages st.rerun() @@ -137,7 +137,7 @@ def _add_page_title(page: StreamlitPage): if page_icon and "/" in page_icon: page_icon = None - st.title(f"{page_icon} {page_title}" ) + st.title(f"{page_icon} {page_title}") add_page_title = gather_metrics("st_pages.add_page_title", _add_page_title) @@ -199,8 +199,10 @@ def _get_pages_from_config(path: str = ".streamlit/pages.toml") -> list[Page] | for page in raw_pages: if page.get("is_section"): page["path"] = "" - pages.append(Section(page["name"], page["icon"] if hasattr(page, 'icon') else None)) # type: ignore + pages.append( + Section(page["name"], page["icon"] if hasattr(page, "icon") else None) + ) # type: ignore else: pages.append(Page(**page)) # type: ignore - return pages \ No newline at end of file + return pages