Every line of 'str to bool python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
2332 def _str_to_bool(bool_str): 2333 if len(bool_str) > 1: 2334 bool_str = bool_str[0] 2335 return unicode(bool_str).upper() == 'T'
23 def _str_to_bool(in_str): 24 if "t" in in_str.lower(): 25 return True 26 else: 27 return False
40 def convert_str_to_bool(str: str) -> bool: 41 """ 42 Convert string to boolean. 43 44 :param str: given string 45 :return: converted string 46 """ 47 try: 48 return str.lower() in ('yes', 'true', 't', '1') 49 except AttributeError as err: 50 logger.error(err)
181 def to_bool(s): 182 if s.lower() in ("yes", "1", "true", "t", "y"): 183 return True 184 return False
493 def as_bool(b): 494 return str(b).lower() in {"1", "true", "yes", "t", "on"}
25 def str2bool(v): 26 """ 27 argparse does not support True or False in python 28 """ 29 return v.lower() in ("true", "t", "1")
29 def str2bool(v): 30 return v.lower() in ("yes", "true", "t", "1")
43 def bool2str(b): 44 if b: 45 return "true" 46 else: 47 return "false"
67 def to_bool(s): 68 """ 69 Converts the given string to a boolean. 70 """ 71 return s.lower() in ('1', 'true', 'yes', 'on')
53 def to_bool(val): 54 if not val: 55 return False 56 57 if isinstance(val, str): 58 return val.lower() not in ('0', 'false', 'f', 'off') 59 else: 60 return bool(val)