diff --git a/anuga/damage_modelling/exposure.py b/anuga/damage_modelling/exposure.py index 282d51549..ef4fb1db0 100644 --- a/anuga/damage_modelling/exposure.py +++ b/anuga/damage_modelling/exposure.py @@ -1,4 +1,4 @@ -from past.builtins import cmp + from builtins import zip from builtins import range from builtins import object @@ -17,7 +17,8 @@ X_TITLE = 'x' Y_TITLE = 'y' - +def cmp_0(a, b): + return (a > b) - (a < b) class Exposure(object): """Class for National Exposure Database storage (NEXIS). @@ -110,17 +111,17 @@ def __cmp__(self, other): #check that 'other' is an instance of this class if isinstance(self, type(other)): - result = cmp(self._attribute_dic, other._attribute_dic) + result = cmp_0(self._attribute_dic, other._attribute_dic) if result != 0: return result # The order of the columns is important. Therefore.. - result = cmp(self._title_index_dic, other._title_index_dic) + result = cmp_0(self._title_index_dic, other._title_index_dic) if result != 0: return result for self_ls, other_ls in zip(self._attribute_dic, other._attribute_dic): - result = cmp(self._attribute_dic[self_ls], + result = cmp_0(self._attribute_dic[self_ls], other._attribute_dic[other_ls]) if result != 0: return result @@ -161,12 +162,12 @@ def __eq__(self, other): # return result # The order of the columns is important. Therefore.. - #result = cmp(self._title_index_dic, other._title_index_dic) + #result = cmp_0(self._title_index_dic, other._title_index_dic) #if result != 0: # return result #for self_ls, other_ls in zip(self._attribute_dic, # other._attribute_dic): - # result = cmp(self._attribute_dic[self_ls], + # result = cmp_0(self._attribute_dic[self_ls], # other._attribute_dic[other_ls]) # if result != 0: # return result diff --git a/anuga/utilities/model_tools.py b/anuga/utilities/model_tools.py index 242a67ede..c3a504159 100644 --- a/anuga/utilities/model_tools.py +++ b/anuga/utilities/model_tools.py @@ -76,7 +76,7 @@ from anuga.utilities.model_tools import get_BUILDING_polygon_value_list """ -from past.builtins import execfile + import os import glob import numpy @@ -434,7 +434,7 @@ def Create_culvert_bridge_Operator(domain,culvert_bridge_file): globals={} locals={} - execfile(culvert_bridge_file, globals, locals) + exec(open(culvert_bridge_file).read(), globals, locals) #print locals #if 'height' and 'z1' and 'z2' in locals: if 'z1' and 'z2' in locals: diff --git a/run_validations.py b/run_validations.py index 10eb13746..dc6a85012 100644 --- a/run_validations.py +++ b/run_validations.py @@ -1,5 +1,4 @@ -from __future__ import print_function -from past.builtins import execfile + import os @@ -7,5 +6,5 @@ print() print(20*'=' + ' anuga automated validation tests ' + 20*'=') print('Changing to', os.getcwd()) # This is now different from buildroot -execfile('run_auto_validation_tests.py') +exec(open('run_auto_validation_tests.py').read())