Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _string_to_bool(s):
- """Parses the string argument as a boolean"""
- if not isinstance(s, str):
- return bool(s)
- warn_deprecated("2.2", "Passing one of 'on', 'true', 'off', 'false' as a "
- "boolean is deprecated; use an actual boolean "
- "(True/False) instead.")
- if s.lower() in ['on', 'true']:
- return True
- if s.lower() in ['off', 'false']:
- return False
- raise ValueError('String "%s" must be one of: '
- '"on", "off", "true", or "false"' % s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement