mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64. It also makes the code a bit shorter.
This commit is contained in:
parent
cda90e3ff6
commit
1eaf85b89f
4 changed files with 5 additions and 5 deletions
|
@ -98,7 +98,7 @@ def not_in_host_file(self, host):
|
|||
host_fh.close()
|
||||
|
||||
for line in data.split("\n"):
|
||||
if line is None or line.find(" ") == -1:
|
||||
if line is None or " " not in line:
|
||||
continue
|
||||
tokens = line.split()
|
||||
if tokens[0].find(HASHED_KEY_MAGIC) == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue