From 29d3e694013a1e2797ee9016bb2194543edfa053 Mon Sep 17 00:00:00 2001 From: stv Date: Sat, 8 Nov 2014 22:50:49 -0800 Subject: [PATCH 1/2] Fix PEP8: W602 deprecated form of raising exception --- common/lib/sandbox-packages/loncapa/loncapa_check.py | 7 ++++++- common/lib/xmodule/xmodule/capa_module.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/lib/sandbox-packages/loncapa/loncapa_check.py b/common/lib/sandbox-packages/loncapa/loncapa_check.py index 2cd591520e..b873c4d685 100644 --- a/common/lib/sandbox-packages/loncapa/loncapa_check.py +++ b/common/lib/sandbox-packages/loncapa/loncapa_check.py @@ -29,7 +29,12 @@ def lc_choose(index, *args): pass if len(args): return args[0] - raise Exception, "loncapa_check.lc_choose error, index=%s, args=%s" % (index, args) + raise Exception( + "loncapa_check.lc_choose error, index={index}, args={args}".format( + index=index, + args=args, + ) + ) deg2rad = math.pi / 180.0 rad2deg = 180.0 / math.pi diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index b8dc24cf68..dc46017a27 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -88,11 +88,11 @@ class CapaModule(CapaMixin, XModule): except NotFoundError as err: _, _, traceback_obj = sys.exc_info() # pylint: disable=redefined-outer-name - raise ProcessingError, (not_found_error_message, err), traceback_obj + raise ProcessingError(not_found_error_message), None, traceback_obj except Exception as err: _, _, traceback_obj = sys.exc_info() # pylint: disable=redefined-outer-name - raise ProcessingError, (generic_error_message, err), traceback_obj + raise ProcessingError(generic_error_message), None, traceback_obj after = self.get_progress() From ab441dbca1d6db6402a7b9e2eec6b0d9cd7985af Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 25 Nov 2014 13:00:19 -0500 Subject: [PATCH 2/2] Lower PEP8 threshold to 5 violations --- scripts/all-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index 7ee90db0d8..ba83d90950 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -57,7 +57,7 @@ set -e # Violations thresholds for failing the build PYLINT_THRESHOLD=4600 -PEP8_THRESHOLD=10 +PEP8_THRESHOLD=5 source $HOME/jenkins_env