mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Micro-optimization: replace s.find(x)==0 with s.startswith(x)
timeit shows a speedup of ~1.4x on Python 2.7.5 x86_64. It also makes the code a bit shorter.
This commit is contained in:
@@ -108,7 +108,7 @@ class Inventory(object):
|
||||
inv_file = open(host_list)
|
||||
first_line = inv_file.readlines()[0]
|
||||
inv_file.close()
|
||||
if first_line.find('#!') == 0:
|
||||
if first_line.startswith('#!'):
|
||||
shebang_present = True
|
||||
except:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user