Micro-optimization of inventory.expand_hosts.detect_range

This commit is contained in:
Cristian Ciupitu 2014-01-23 16:14:24 +02:00 committed by Michael DeHaan
parent 7b2fb7e2d1
commit a7da5d8702

View file

@ -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