Convert value from query string to the bool format :param qs: value from the query string :type qs: str :return: converted value as bool :rtype: bool
(qs: Union[str, bool])
| 254 | |
| 255 | |
| 256 | def qs_to_bool(qs: Union[str, bool]) -> bool: |
| 257 | """ |
| 258 | Convert value from query string to the bool format |
| 259 | |
| 260 | :param qs: value from the query string |
| 261 | :type qs: str |
| 262 | :return: converted value as bool |
| 263 | :rtype: bool |
| 264 | """ |
| 265 | if type(qs) == bool: |
| 266 | return qs |
| 267 | |
| 268 | qs = qs.lower() |
| 269 | if qs in ("y", "yes", "true", "1", "42", "jawohl", "da"): |
| 270 | return True |
| 271 | else: |
| 272 | return False |