Skip to content

Commit

Permalink
Move to modern Python syntax for exception handling
Browse files Browse the repository at this point in the history
# This will aid any eventual Python 3 conversion!
  • Loading branch information
jsharkey13 committed Jul 26, 2018
1 parent 9c15347 commit 90825f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions checker/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def symbolic_equality(test_expr, target_expr):
return True
else:
return False
except NotImplementedError, e:
except NotImplementedError as e:
print "%s: %s - Can't check symbolic equality!" % (type(e).__name__, e.message.capitalize())
return False

Expand Down Expand Up @@ -627,11 +627,11 @@ def check(test_str, target_str, symbols=None, check_symbols=True, description=No
return result
# Then check for equality proper:
equal, equality_type = general_equality(test_expr, target_expr)
except EquationTypeMismatch, e:
except EquationTypeMismatch as e:
print "Equation/Expression Type Mismatch: can't be equal!"
equal = False
equality_type = "symbolic"
except (SyntaxError, TypeError, AttributeError, NumericRangeException), e:
except (SyntaxError, TypeError, AttributeError, NumericRangeException) as e:
print "Error when comparing expressions: '%s'." % e
if not _quiet:
print "=" * 50
Expand Down
2 changes: 1 addition & 1 deletion checker/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def check_endpoint():
with TimeoutProtection(MAX_REQUEST_COMPUTATION_TIME):
response_dict = api.check(test_str, target_str, symbols, check_symbols, description)
return jsonify(**response_dict)
except TimeoutException, e:
except TimeoutException as e:
print "ERROR: %s - Request took too long to process, aborting!" % type(e).__name__
print "=" * 50
error_dict = dict(
Expand Down

0 comments on commit 90825f7

Please sign in to comment.