diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-11 18:43:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-11 18:43:09 +0000 |
| commit | 109e1b525dc96fd2d523dbc41c018ee975030e82 (patch) | |
| tree | c33556b56380515caca0219f49e4f2f69bb3dcb8 /openstack/common/strutils.py | |
| parent | 165b98415d3949f8a9dddbdbc1f304fb7d257718 (diff) | |
| parent | 7119e29cb535426c587eaf2cfc2cfcd11a422df0 (diff) | |
| download | oslo-109e1b525dc96fd2d523dbc41c018ee975030e82.tar.gz oslo-109e1b525dc96fd2d523dbc41c018ee975030e82.tar.xz oslo-109e1b525dc96fd2d523dbc41c018ee975030e82.zip | |
Merge "Enable hacking H404 test."
Diffstat (limited to 'openstack/common/strutils.py')
| -rw-r--r-- | openstack/common/strutils.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/openstack/common/strutils.py b/openstack/common/strutils.py index 8a5367b..bbe2c92 100644 --- a/openstack/common/strutils.py +++ b/openstack/common/strutils.py @@ -40,8 +40,7 @@ FALSE_STRINGS = ('0', 'f', 'false', 'off', 'n', 'no') def int_from_bool_as_string(subject): - """ - Interpret a string as a boolean and return either 1 or 0. + """Interpret a string as a boolean and return either 1 or 0. Any string value in: @@ -55,8 +54,7 @@ def int_from_bool_as_string(subject): def bool_from_string(subject, strict=False): - """ - Interpret a string as a boolean. + """Interpret a string 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 @@ -89,9 +87,7 @@ def bool_from_string(subject, strict=False): def safe_decode(text, incoming=None, errors='strict'): - """ - Decodes incoming str using `incoming` if they're - not already unicode. + """Decodes incoming str using `incoming` if they're not already unicode. :param incoming: Text's current encoding :param errors: Errors handling policy. See here for valid @@ -130,11 +126,10 @@ def safe_decode(text, incoming=None, errors='strict'): def safe_encode(text, incoming=None, encoding='utf-8', errors='strict'): - """ - Encodes incoming str/unicode using `encoding`. If - incoming is not specified, text is expected to - be encoded with current python's default encoding. - (`sys.getdefaultencoding`) + """Encodes incoming str/unicode using `encoding`. + + If incoming is not specified, text is expected to be encoded with + current python's default encoding. (`sys.getdefaultencoding`) :param incoming: Text's current encoding :param encoding: Expected encoding for text (Default UTF-8) |
