Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 4, 2024
1 parent e44b194 commit 86bc27b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/st_pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
]
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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
return pages

0 comments on commit 86bc27b

Please sign in to comment.