mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00: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:
committed by
Michael DeHaan
parent
a7da5d8702
commit
0749112286
@@ -250,7 +250,7 @@ def regular_generic_msg(hostname, result, oneline, caption):
|
||||
|
||||
def banner_cowsay(msg):
|
||||
|
||||
if msg.find(": [") != -1:
|
||||
if ": [" in msg:
|
||||
msg = msg.replace("[","")
|
||||
if msg.endswith("]"):
|
||||
msg = msg[:-1]
|
||||
|
||||
Reference in New Issue
Block a user