Utilities/__init__.py

changeset 2030
db11a2fe9bbc
parent 1914
fa4d57a6c3a9
child 2079
febae63bb821
equal deleted inserted replaced
2028:30247d523fdb 2030:db11a2fe9bbc
1676 print('Please install another version.') 1676 print('Please install another version.')
1677 return False 1677 return False
1678 1678
1679 return True 1679 return True
1680 1680
1681
1682 def toBool(dataStr):
1683 """
1684 Module function to convert a string to a boolean value.
1685
1686 @param dataStr string to be converted (string)
1687 @return converted boolean value (boolean)
1688 """
1689 if dataStr in [ "True", "true", "1", "Yes", "yes"]:
1690 return True
1691 elif dataStr in ["False", "false", "0", "No", "no"]:
1692 return False
1693 else:
1694 return bool(dataStr)
1695
1681 ################################################################################ 1696 ################################################################################
1682 # posix compatibility functions below 1697 # posix compatibility functions below
1683 ################################################################################ 1698 ################################################################################
1684 1699
1685 # None right now 1700 # None right now

eric ide

mercurial