Skip to content

Commit d00ac20

Browse files
committed
chore: rename variable to avoid confusion with type
1 parent 380f69b commit d00ac20

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

scripts/_functions_sass.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,11 @@ ShinyThemePreset = Literal[
398398
%s
399399
]
400400
401-
ShinyThemePresets: tuple[ShinyThemePreset, ...] = (
401+
shiny_theme_presets: tuple[ShinyThemePreset, ...] = (
402402
%s
403403
)
404404
405-
ShinyThemePresetsBundled: tuple[ShinyThemePreset, ...] = (
405+
shiny_theme_presets_bundled: tuple[ShinyThemePreset, ...] = (
406406
%s
407407
))"
408408

shiny/ui/_theme.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from .._versions import bootstrap
1414
from ._theme_presets import (
1515
ShinyThemePreset,
16-
ShinyThemePresets,
17-
ShinyThemePresetsBundled,
16+
shiny_theme_presets,
17+
shiny_theme_presets_bundled,
1818
)
1919
from ._utils import path_pkg_www
2020

@@ -80,7 +80,7 @@ def __init__(
8080
# 1. "precompiled" indicating it's okay to use precompiled preset.min.css
8181
# 2. "" indicating that the CSS has not been compiled yet
8282
# 3. A string containing the compiled CSS for the current theme
83-
self._css: str = "precompiled" if preset in ShinyThemePresetsBundled else ""
83+
self._css: str = "precompiled" if preset in shiny_theme_presets_bundled else ""
8484

8585
# If the theme has been customized and rendered once, we store the tempdir
8686
# so that we can re-use the already compiled CSS file.
@@ -91,7 +91,7 @@ def available_presets(cls) -> tuple[ShinyThemePreset, ...]:
9191
"""
9292
Get a list of available theme presets.
9393
"""
94-
return ShinyThemePresets
94+
return shiny_theme_presets
9595

9696
@property
9797
def preset(self) -> ShinyThemePreset:
@@ -112,7 +112,7 @@ def preset(self, value: ShinyThemePreset) -> None:
112112
if has_customizations:
113113
self._css = ""
114114
else:
115-
self._css = "precompiled" if value in ShinyThemePresetsBundled else ""
115+
self._css = "precompiled" if value in shiny_theme_presets_bundled else ""
116116

117117
self._css_temp_srcdir = None
118118

@@ -347,10 +347,10 @@ def path_pkg_preset(preset: ShinyThemePreset, *args: str) -> str:
347347

348348

349349
def check_is_valid_preset(preset: ShinyThemePreset) -> None:
350-
if preset not in ShinyThemePresets:
350+
if preset not in shiny_theme_presets:
351351
raise ValueError(
352352
f"Invalid preset '{preset}'.\n"
353-
+ f"""Expected one of: "{'", "'.join(ShinyThemePresets)}".""",
353+
+ f"""Expected one of: "{'", "'.join(shiny_theme_presets)}".""",
354354
)
355355

356356

shiny/ui/_theme_presets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"zephyr",
3535
]
3636

37-
ShinyThemePresets: tuple[ShinyThemePreset, ...] = (
37+
shiny_theme_presets: tuple[ShinyThemePreset, ...] = (
3838
"bootstrap",
3939
"shiny",
4040
"cerulean",
@@ -64,7 +64,7 @@
6464
"zephyr",
6565
)
6666

67-
ShinyThemePresetsBundled: tuple[ShinyThemePreset, ...] = (
67+
shiny_theme_presets_bundled: tuple[ShinyThemePreset, ...] = (
6868
"bootstrap",
6969
"shiny",
7070
)

tests/pytest/test_theme.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from shiny.ui import Theme
44
from shiny.ui._theme import (
55
ShinyThemePreset,
6-
ShinyThemePresets,
7-
ShinyThemePresetsBundled,
6+
shiny_theme_presets,
7+
shiny_theme_presets_bundled,
88
)
99

1010

@@ -64,10 +64,10 @@ def test_theme_preset_must_be_valid():
6464
Theme("not_a_valid_preset") # type: ignore
6565

6666

67-
@pytest.mark.parametrize("preset", ShinyThemePresets)
67+
@pytest.mark.parametrize("preset", shiny_theme_presets)
6868
def test_theme_css_compiles_and_is_cached(preset: ShinyThemePreset):
6969
theme = Theme(preset)
70-
if preset in ShinyThemePresetsBundled:
70+
if preset in shiny_theme_presets_bundled:
7171
assert theme._css == "precompiled"
7272
else:
7373
assert theme._css == ""
@@ -92,18 +92,18 @@ def test_theme_css_compiles_and_is_cached(preset: ShinyThemePreset):
9292
def test_theme_update_preset():
9393
theme = Theme("shiny")
9494
assert theme._preset == "shiny"
95-
assert theme._css == "precompiled" if "shiny" in ShinyThemePresetsBundled else ""
95+
assert theme._css == "precompiled" if "shiny" in shiny_theme_presets_bundled else ""
9696

9797
theme.preset = "bootstrap"
9898
assert theme._preset == "bootstrap"
9999
assert theme._css == (
100-
"precompiled" if "bootstrap" in ShinyThemePresetsBundled else ""
100+
"precompiled" if "bootstrap" in shiny_theme_presets_bundled else ""
101101
)
102102

103103
theme.preset = "sketchy"
104104
assert theme._preset == "sketchy"
105105
assert theme._css == (
106-
"precompiled" if "sketchy" in ShinyThemePresetsBundled else ""
106+
"precompiled" if "sketchy" in shiny_theme_presets_bundled else ""
107107
)
108108

109109
with pytest.raises(ValueError, match="Invalid preset"):

0 commit comments

Comments
 (0)