little-boxes/little_boxes/__init__.py

13 wiersze
271 B
Python
Czysty Zwykły widok Historia

2018-06-11 20:50:02 +00:00
import logging
logger = logging.getLogger(__name__)
def strtobool(s: str) -> bool:
2018-06-12 17:57:40 +00:00
if s in ["y", "yes", "true", "on", "1"]:
2018-06-11 20:50:02 +00:00
return True
2018-06-12 17:57:40 +00:00
if s in ["n", "no", "false", "off", "0"]:
2018-06-11 20:50:02 +00:00
return False
2018-06-12 17:57:40 +00:00
raise ValueError(f"cannot convert {s} to bool")