mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +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:
@@ -1008,7 +1008,7 @@ class SunOSService(Service):
|
||||
# enabled true
|
||||
# enabled false
|
||||
for line in stdout.split("\n"):
|
||||
if line.find("enabled") == 0:
|
||||
if line.startswith("enabled"):
|
||||
if "true" in line:
|
||||
enabled = True
|
||||
if "temporary" in line:
|
||||
|
||||
Reference in New Issue
Block a user