]> ToastFreeware Gitweb - philipp/winterrodeln/wrpylib.git/blob - wrpylib/argparse_tools.py
VAO is missing important streets in Switzerland.
[philipp/winterrodeln/wrpylib.git] / wrpylib / argparse_tools.py
1 import argparse
2
3
4 def bool_type(value: str) -> bool:
5     """Helper function for argparse (string to bool conversion)."""
6     value = value.lower()
7     if value in ['1', 'true', 't', 'yes', 'y']:
8         return True
9     if value in ['0', 'false', 'f', 'no', 'n']:
10         return False
11     raise argparse.ArgumentTypeError(f'"{value}" could not be converted to bool.')