From fc069d154b4a504d1611cfcfb783ee68067961f4 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Thu, 28 Aug 2014 10:03:37 +1000 Subject: [PATCH] Just use int(BOOL) to convert to 1 or 0 (This is split out from I24461f4328e188c8983ad574495e11e033ec5ba4 on neutron, which was a hunt to remove "PRED and A or B" deprecated ternary idiom.) int(bool) already returns only 1 or 0 - no need to do our own explicit version. Change-Id: Ib482d6cb63ece7e1d5073fa7dc1c7daf9db8a0b3 --- oslo/utils/strutils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslo/utils/strutils.py b/oslo/utils/strutils.py index 5550e77..26da39b 100644 --- a/oslo/utils/strutils.py +++ b/oslo/utils/strutils.py @@ -94,7 +94,7 @@ def int_from_bool_as_string(subject): Useful for JSON-decoded stuff and config file parsing """ - return bool_from_string(subject) and 1 or 0 + return int(bool_from_string(subject)) def bool_from_string(subject, strict=False, default=False):