mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-24 09:10: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
|
@ -154,7 +154,7 @@ def keysum(module, gs, bucket, obj):
|
|||
key_check = bucket.get_key(obj)
|
||||
if key_check:
|
||||
md5_remote = key_check.etag[1:-1]
|
||||
etag_multipart = md5_remote.find('-')!=-1 #Check for multipart, etag is not md5
|
||||
etag_multipart = '-' in md5_remote # Check for multipart, etag is not md5
|
||||
if etag_multipart is True:
|
||||
module.fail_json(msg="Files uploaded with multipart of gs are not supported with checksum, unable to compute checksum.")
|
||||
return md5_remote
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue