doc: Fix docstring of method bool_from_string

Method bool_from_string accept boolean, string, and integer value.
This commit adjusts the document to reflect acceptable argument type.

Change-Id: I836d2bed89c22dc123052fbb580c0601076c12ab
This commit is contained in:
ChangBo Guo(gcb) 2016-09-30 21:13:21 +08:00
parent d9731819c4
commit 0068712203
1 changed files with 7 additions and 4 deletions

View File

@ -111,11 +111,14 @@ def int_from_bool_as_string(subject):
def bool_from_string(subject, strict=False, default=False):
"""Interpret a string as a boolean.
"""Interpret a subject as a boolean.
A case-insensitive match is performed such that strings matching 't',
'true', 'on', 'y', 'yes', or '1' are considered True and, when
`strict=False`, anything else returns the value specified by 'default'.
A subject can be a boolean, a string or an integer. Boolean type value
will be returned directly, otherwise the subject will be converted to
a string. A case-insensitive match is performed such that strings
matching 't','true', 'on', 'y', 'yes', or '1' are considered True and,
when `strict=False`, anything else returns the value specified by
'default'.
Useful for JSON-decoded stuff and config file parsing.