Skip to content

Commit 67966e2

Browse files
committed
strtobool -> str_to_bool
1 parent e7d1764 commit 67966e2

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/reactpy_django/templatetags/reactpy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
prerender_component,
2121
reactpy_to_string,
2222
save_component_params,
23-
strtobool,
23+
str_to_bool,
2424
validate_component_args,
2525
validate_host,
2626
)
@@ -128,7 +128,7 @@ def component(
128128
return failure_context(dotted_path, e)
129129

130130
# Pre-render the component, if requested
131-
if strtobool(prerender):
131+
if str_to_bool(prerender):
132132
if not is_local:
133133
msg = "Cannot pre-render non-local components."
134134
_logger.error(msg)

src/reactpy_django/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def get_pk(model):
367367
return getattr(model, model._meta.pk.name)
368368

369369

370-
def strtobool(val: str) -> bool:
370+
def str_to_bool(val: str) -> bool:
371371
"""Convert a string representation of truth to true (1) or false (0).
372372
373373
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values

tests/test_app/tests/test_components.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
from playwright.sync_api import TimeoutError, expect
99

1010
from reactpy_django.models import ComponentSession
11-
from reactpy_django.utils import strtobool
11+
from reactpy_django.utils import str_to_bool
1212

1313
from .utils import GITHUB_ACTIONS, PlaywrightTestCase, navigate_to_page
1414

15-
CLICK_DELAY = 250 if strtobool(GITHUB_ACTIONS) else 25 # Delay in miliseconds.
15+
CLICK_DELAY = 250 if str_to_bool(GITHUB_ACTIONS) else 25 # Delay in miliseconds.
1616

1717

1818
class GenericComponentTests(PlaywrightTestCase):

tests/test_app/tests/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from django.test.utils import modify_settings
1313
from playwright.sync_api import sync_playwright
1414

15-
from reactpy_django.utils import strtobool
15+
from reactpy_django.utils import str_to_bool
1616

1717
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS", "False")
1818

@@ -41,7 +41,7 @@ def setUpClass(cls):
4141
if sys.platform == "win32":
4242
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
4343
cls.playwright = sync_playwright().start()
44-
headless = strtobool(os.environ.get("PLAYWRIGHT_HEADLESS", GITHUB_ACTIONS))
44+
headless = str_to_bool(os.environ.get("PLAYWRIGHT_HEADLESS", GITHUB_ACTIONS))
4545
cls.browser = cls.playwright.chromium.launch(headless=bool(headless))
4646
cls.page = cls.browser.new_page()
4747
cls.page.set_default_timeout(10000)

0 commit comments

Comments
 (0)