From 7ea56e1c79eb7b39ab252aa99946b21a77b36b71 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 4 Aug 2016 11:32:26 -0400 Subject: [PATCH] optimize booleanifycation --- lib/ansible/constants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index f6311f28f6..e24ed82341 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -29,12 +29,14 @@ from ansible.compat.six.moves import configparser from ansible.parsing.quoting import unquote from ansible.errors import AnsibleOptionsError +BOOL_TRUE = frozenset([ "true", "t", "y", "1", "yes", "on" ]) + # copied from utils, avoid circular reference fun :) def mk_boolean(value): if value is None: return False val = str(value) - if val.lower() in [ "true", "t", "y", "1", "yes", "on" ]: + if val.lower() in BOOL_TRUE: return True else: return False