Permalink
Browse files

Merge branch 'yarikoptic-develop' into develop

* yarikoptic-develop:
  Undo log message change
  BF(PY3): use except ... as   syntax instead of except ...,
  • Loading branch information...
2 parents 22ab610 + 49bedf4 commit 607cad7110db593212b5625a6b869688e4d713e0 @jamesls jamesls committed Dec 22, 2015
View
@@ -103,6 +103,6 @@ if __name__ == "__main__":
cmd = help
try:
cmd(cf, *args)
- except TypeError, e:
+ except TypeError as e:
print e
help(cf, cmd.__name__)
View
@@ -65,15 +65,15 @@ def main():
if queue_name:
try:
rs = [c.create_queue(queue_name)]
- except SQSError, e:
+ except SQSError as e:
print 'An Error Occurred:'
print '%s: %s' % (e.status, e.reason)
print e.body
sys.exit()
else:
try:
rs = c.get_all_queues()
- except SQSError, e:
+ except SQSError as e:
print 'An Error Occurred:'
print '%s: %s' % (e.status, e.reason)
print e.body
View
@@ -135,6 +135,6 @@ if __name__ == "__main__":
cmd = help
try:
cmd(*args)
- except TypeError, e:
+ except TypeError as e:
print e
help(cmd.__name__)
View
@@ -200,6 +200,6 @@ if __name__ == "__main__":
cmd = help
try:
cmd(conn, *args)
- except TypeError, e:
+ except TypeError as e:
print e
help(conn, cmd.__name__)
@@ -64,10 +64,10 @@ def main(self):
self.run("/usr/sbin/xfs_freeze -f ${mount_point}", exit_on_error = True)
snapshot = ec2.create_snapshot('${volume_id}')
boto.log.info("Snapshot created: %s " % snapshot)
- except Exception, e:
+ except Exception as e:
self.notify(subject="${instance_id} Backup Failed", body=traceback.format_exc())
boto.log.info("Snapshot created: ${volume_id}")
- except Exception, e:
+ except Exception as e:
self.notify(subject="${instance_id} Backup Failed", body=traceback.format_exc())
finally:
self.run("/usr/sbin/xfs_freeze -u ${mount_point}")
View
@@ -31,7 +31,7 @@
try:
release = os.environ.get('SVN_REVISION', 'HEAD')
print release
-except Exception, e:
+except Exception as e:
print e
html_title = "boto v%s" % version
@@ -338,7 +338,7 @@ The workers only need to know which task lists to poll.
try:
print 'working on activity from tasklist %s at %i' % (self.task_list, time.time())
self.activity(activity_task.get('input'))
- except Exception, error:
+ except Exception as error:
self.fail(reason=str(error))
raise error
View
@@ -88,7 +88,7 @@ def test_bad_request(self):
try:
self.fps.write_off_debt(CreditInstrumentId='foo',
AdjustmentAmount=123.45)
- except Exception, e:
+ except Exception as e:
print e
@unittest.skip('cosmetic')
@@ -102,7 +102,7 @@ def test_failed_download_with_persistent_tracker(self):
dst_fp, cb=harness.call,
res_download_handler=res_download_handler)
self.fail('Did not get expected ResumableDownloadException')
- except ResumableDownloadException, e:
+ except ResumableDownloadException as e:
# We'll get a ResumableDownloadException at this point because
# of CallbackTestHarness (above). Check that the tracker file was
# created correctly.
@@ -164,7 +164,7 @@ def test_non_retryable_exception_handling(self):
dst_fp, cb=harness.call,
res_download_handler=res_download_handler)
self.fail('Did not get expected OSError')
- except OSError, e:
+ except OSError as e:
# Ensure the error was re-raised.
self.assertEqual(e.errno, 13)
@@ -228,7 +228,7 @@ def test_multiple_in_process_failures_then_succeed_with_tracker_file(self):
dst_fp, cb=harness.call,
res_download_handler=res_download_handler)
self.fail('Did not get expected ResumableDownloadException')
- except ResumableDownloadException, e:
+ except ResumableDownloadException as e:
self.assertEqual(e.disposition,
ResumableTransferDisposition.ABORT_CUR_PROCESS)
# Ensure a tracker file survived.
@@ -345,7 +345,7 @@ def test_download_with_unwritable_tracker_file(self):
os.chmod(tmp_dir, 0)
res_download_handler = ResumableDownloadHandler(
tracker_file_name=tracker_file_name)
- except ResumableDownloadException, e:
+ except ResumableDownloadException as e:
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
self.assertNotEqual(
e.message.find('Couldn\'t write URI tracker file'), -1)
@@ -120,7 +120,7 @@ def test_failed_upload_with_persistent_tracker(self):
small_src_file, cb=harness.call,
res_upload_handler=res_upload_handler)
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
# We'll get a ResumableUploadException at this point because
# of CallbackTestHarness (above). Check that the tracker file was
# created correctly.
@@ -185,7 +185,7 @@ def test_non_retryable_exception_handling(self):
small_src_file, cb=harness.call,
res_upload_handler=res_upload_handler)
self.fail('Did not get expected OSError')
- except OSError, e:
+ except OSError as e:
# Ensure the error was re-raised.
self.assertEqual(e.errno, 13)
@@ -247,7 +247,7 @@ def test_multiple_in_process_failures_then_succeed_with_tracker_file(self):
larger_src_file, cb=harness.call,
res_upload_handler=res_upload_handler)
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
self.assertEqual(e.disposition,
ResumableTransferDisposition.ABORT_CUR_PROCESS)
# Ensure a tracker file survived.
@@ -351,7 +351,7 @@ def test_upload_with_file_size_change_between_starts(self):
larger_src_file, cb=harness.call,
res_upload_handler=res_upload_handler)
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
# First abort (from harness-forced failure) should be
# ABORT_CUR_PROCESS.
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT_CUR_PROCESS)
@@ -368,7 +368,7 @@ def test_upload_with_file_size_change_between_starts(self):
dst_key.set_contents_from_file(
largest_src_file, res_upload_handler=res_upload_handler)
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
# This abort should be a hard abort (file size changing during
# transfer).
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
@@ -391,7 +391,7 @@ def test_upload_with_file_size_change_during_upload(self):
test_file, cb=harness.call,
res_upload_handler=res_upload_handler)
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
self.assertNotEqual(
e.message.find('File changed during upload'), -1)
@@ -411,7 +411,7 @@ def Execute():
test_file, cb=harness.call,
res_upload_handler=res_upload_handler)
return False
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
# Ensure the file size didn't change.
test_file.seek(0, os.SEEK_END)
@@ -422,7 +422,7 @@ def Execute():
try:
dst_key_uri.get_key()
self.fail('Did not get expected InvalidUriError')
- except InvalidUriError, e:
+ except InvalidUriError as e:
pass
return True
@@ -477,7 +477,7 @@ def test_upload_with_content_length_header_set(self):
small_src_file, res_upload_handler=res_upload_handler,
headers={'Content-Length' : SMALL_KEY_SIZE})
self.fail('Did not get expected ResumableUploadException')
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
self.assertNotEqual(
e.message.find('Attempt to specify Content-Length header'), -1)
@@ -543,7 +543,7 @@ def test_upload_with_unwritable_tracker_file(self):
os.chmod(tmp_dir, 0)
res_upload_handler = ResumableUploadHandler(
tracker_file_name=tracker_file_name)
- except ResumableUploadException, e:
+ except ResumableUploadException as e:
self.assertEqual(e.disposition, ResumableTransferDisposition.ABORT)
self.assertNotEqual(
e.message.find('Couldn\'t write URI tracker file'), -1)
@@ -61,11 +61,11 @@ def tearDown(self):
for k in bucket.list_versions():
try:
bucket.delete_key(k.name, generation=k.generation)
- except GSResponseError, e:
+ except GSResponseError as e:
if e.status != 404:
raise
bucket.delete()
- except GSResponseError, e:
+ except GSResponseError as e:
if e.status != 404:
raise
self._buckets.pop()
@@ -70,7 +70,7 @@ def f_retry(*args, **kwargs):
return f(*args, **kwargs)
try_one_last_time = False
break
- except ExceptionToCheck, e:
+ except ExceptionToCheck as e:
msg = "%s, Retrying in %d seconds..." % (str(e), mdelay)
if logger:
logger.warning(msg)
@@ -17,7 +17,7 @@ def has_selenium():
# a little trick to see if the server is responding
try:
sel.do_command('shutdown', '')
- except Exception, e:
+ except Exception as e:
if not 'Server Exception' in str(e):
raise
result = True

0 comments on commit 607cad7

Please sign in to comment.