mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +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
@@ -128,7 +128,7 @@ class ActionModule(object):
|
||||
result = handler.run(conn, tmp, 'raw', module_args, inject)
|
||||
|
||||
# clean up after
|
||||
if tmp.find("tmp") != -1 and not C.DEFAULT_KEEP_REMOTE_FILES:
|
||||
if "tmp" in tmp and not C.DEFAULT_KEEP_REMOTE_FILES:
|
||||
self.runner._low_level_exec_command(conn, 'rm -rf %s >/dev/null 2>&1' % tmp, tmp)
|
||||
|
||||
result.result['changed'] = True
|
||||
|
||||
Reference in New Issue
Block a user