From a7da5d870227902816fb9df4bd4dde853cdefd35 Mon Sep 17 00:00:00 2001 From: Cristian Ciupitu Date: Thu, 23 Jan 2014 16:14:24 +0200 Subject: [PATCH] Micro-optimization of inventory.expand_hosts.detect_range --- lib/ansible/inventory/expand_hosts.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ansible/inventory/expand_hosts.py b/lib/ansible/inventory/expand_hosts.py index a1db9f1c6a4..b1cc0dcb82f 100644 --- a/lib/ansible/inventory/expand_hosts.py +++ b/lib/ansible/inventory/expand_hosts.py @@ -41,10 +41,7 @@ def detect_range(line = None): Returnes True if the given line contains a pattern, else False. ''' - if (line.find("[") != -1 and - line.find(":") != -1 and - line.find("]") != -1 and - line.index("[") < line.index(":") < line.index("]")): + if 0 <= line.find("[") < line.find(":") < line.find("]"): return True else: return False