Skip to content

Commit 1844151

Browse files
committed
Add type hints to strtobool
1 parent 7377659 commit 1844151

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/reactpy_django/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def get_pk(model):
376376
return getattr(model, model._meta.pk.name)
377377

378378

379-
def strtobool(val):
379+
def strtobool(val: str) -> bool:
380380
"""Convert a string representation of truth to true (1) or false (0).
381381
382382
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
@@ -385,9 +385,9 @@ def strtobool(val):
385385
"""
386386
val = val.lower()
387387
if val in {"y", "yes", "t", "true", "on", "1"}:
388-
return 1
388+
return True
389389
if val in {"n", "no", "f", "false", "off", "0"}:
390-
return 0
390+
return False
391391
msg = f"invalid truth value {val}"
392392
raise ValueError(msg)
393393

0 commit comments

Comments
 (0)