... | ... |
@@ -159,11 +159,11 @@ class ACL(object): |
159 | 159 |
grantee.name = name |
160 | 160 |
grantee.permission = permission |
161 | 161 |
|
162 |
- if name.find('@') > -1: |
|
162 |
+ if '@' in name: |
|
163 | 163 |
grantee.name = grantee.name.lower() |
164 | 164 |
grantee.xsi_type = "AmazonCustomerByEmail" |
165 | 165 |
grantee.tag = "EmailAddress" |
166 |
- elif name.find('http://acs.amazonaws.com/groups/') > -1: |
|
166 |
+ elif 'http://acs.amazonaws.com/groups/' in name: |
|
167 | 167 |
grantee.xsi_type = "Group" |
168 | 168 |
grantee.tag = "URI" |
169 | 169 |
else: |
... | ... |
@@ -388,7 +388,7 @@ def fetch_remote_list(args, require_attribs = False, recursive = None, uri_param |
388 | 388 |
'dev' : None, |
389 | 389 |
'inode' : None, |
390 | 390 |
} |
391 |
- if rem_list[key]['md5'].find("-") > 0: # always get it for multipart uploads |
|
391 |
+ if '-' in rem_list[key]['md5']: # always get it for multipart uploads |
|
392 | 392 |
_get_remote_attribs(S3Uri(object_uri_str), rem_list[key]) |
393 | 393 |
md5 = rem_list[key]['md5'] |
394 | 394 |
rem_list.record_md5(key, md5) |
... | ... |
@@ -478,7 +478,7 @@ def compare_filelists(src_list, dst_list, src_remote, dst_remote, delay_updates |
478 | 478 |
compare_md5 = 'md5' in cfg.sync_checks |
479 | 479 |
# Multipart-uploaded files don't have a valid md5 sum - it ends with "...-nn" |
480 | 480 |
if compare_md5: |
481 |
- if (src_remote == True and src_list[file]['md5'].find("-") >= 0) or (dst_remote == True and dst_list[file]['md5'].find("-") >= 0): |
|
481 |
+ if (src_remote == True and '-' in src_list[file]['md5']) or (dst_remote == True and '-' in dst_list[file]['md5']): |
|
482 | 482 |
compare_md5 = False |
483 | 483 |
info(u"disabled md5 check for %s" % file) |
484 | 484 |
if attribs_match and compare_md5: |
... | ... |
@@ -61,7 +61,7 @@ try: |
61 | 61 |
return magic_.file(file) |
62 | 62 |
|
63 | 63 |
except ImportError, e: |
64 |
- if str(e).find("magic") >= 0: |
|
64 |
+ if 'magic' in str(e): |
|
65 | 65 |
magic_message = "Module python-magic is not available." |
66 | 66 |
else: |
67 | 67 |
magic_message = "Module python-magic can't be used (%s)." % e.message |
... | ... |
@@ -439,7 +439,7 @@ class S3(object): |
439 | 439 |
return (request, body) |
440 | 440 |
|
441 | 441 |
def add_encoding(self, filename, content_type): |
442 |
- if content_type.find("charset=") != -1: |
|
442 |
+ if 'charset=' in content_type: |
|
443 | 443 |
return False |
444 | 444 |
exts = self.config.add_encoding_exts.split(',') |
445 | 445 |
if exts[0]=='': |
... | ... |
@@ -1174,7 +1174,7 @@ class S3(object): |
1174 | 1174 |
except KeyError: |
1175 | 1175 |
pass |
1176 | 1176 |
|
1177 |
- response["md5match"] = md5_hash.find(response["md5"]) >= 0 |
|
1177 |
+ response["md5match"] = response["md5"] in md5_hash |
|
1178 | 1178 |
response["elapsed"] = timestamp_end - timestamp_start |
1179 | 1179 |
response["size"] = current_position |
1180 | 1180 |
response["speed"] = response["elapsed"] and float(response["size"]) / response["elapsed"] or float(-1) |
... | ... |
@@ -90,7 +90,7 @@ if not os.path.isdir('testsuite/crappy-file-name'): |
90 | 90 |
def test(label, cmd_args = [], retcode = 0, must_find = [], must_not_find = [], must_find_re = [], must_not_find_re = []): |
91 | 91 |
def command_output(): |
92 | 92 |
print "----" |
93 |
- print " ".join([arg.find(" ")>=0 and "'%s'" % arg or arg for arg in cmd_args]) |
|
93 |
+ print " ".join([" " in arg and "'%s'" % arg or arg for arg in cmd_args]) |
|
94 | 94 |
print "----" |
95 | 95 |
print stdout |
96 | 96 |
print "----" |
... | ... |
@@ -245,7 +245,7 @@ while argv: |
245 | 245 |
print "Bucket prefix option must explicitly supply a bucket name prefix" |
246 | 246 |
sys.exit(0) |
247 | 247 |
continue |
248 |
- if arg.find("..") >= 0: |
|
248 |
+ if ".." in arg: |
|
249 | 249 |
range_idx = arg.find("..") |
250 | 250 |
range_start = arg[:range_idx] or 0 |
251 | 251 |
range_end = arg[range_idx+2:] or 999 |
... | ... |
@@ -175,7 +175,7 @@ def subcmd_bucket_list(s3, uri): |
175 | 175 |
for object in response["list"]: |
176 | 176 |
md5 = object['ETag'].strip('"\'') |
177 | 177 |
if cfg.list_md5: |
178 |
- if md5.find('-') >= 0: # need to get md5 from the object |
|
178 |
+ if '-' in md5.find('-'): # need to get md5 from the object |
|
179 | 179 |
object_uri = uri.compose_uri(bucket, object["Key"]) |
180 | 180 |
info_response = s3.object_info(S3Uri(object_uri)) |
181 | 181 |
try: |