if sys.version_info[0] == 2:
del self.__adaoObject # Because it breaks pickle in Python 2. Not required for Python 3
del self.__case # Because it breaks pickle in Python 2. Not required for Python 3
- return 0
+ if sys.version_info.major < 3:
+ return 0
+ else:
+ return self.__StoredInputs
# ==============================================================================
if __name__ == "__main__":
def validationReportforJDC(self):
rtn = "<i>Validation report is empty.</i>"
if self.eficas_editor.jdc:
- rtn = u"Validation report for the selected ADAO case:\n\n"
- rtn += unicode( self.eficas_editor.jdc.report())
+ rtn = "Validation report for the selected ADAO case:\n\n"
+ rtn += self.eficas_editor.jdc.report()
return rtn
def showTreeAdaoCase(self):
import pickle
import numpy
import threading
+import sys
# Pour disposer des classes dans l'espace de nommage lors du pickle
from daCore.AssimilationStudy import AssimilationStudy
self.pool.destroyAll()
def obs(self, var, info):
- # print "Call observer %s" % info
+ # print("Call observer %s with var type %s" %(info,type(var))
sample = pilot.StructAny_New(self.runtime.getTypeCode('SALOME_TYPES/ParametricInput'))
# Fake data
# # Remove data observers, required to pickle assimilation study object
# for observer_name in list(self.da_study.observers_dict.keys()):
# self.ADD.removeDataObserver(observer_name, self.obs)
- self.da_study.YI_prepare_to_pickle()
- result = pickle.dumps(self.da_study)
- return result
+ if sys.version_info.major < 3:
+ self.da_study.YI_prepare_to_pickle()
+ return pickle.dumps(self.da_study)
+ else:
+ return pickle.dumps(self.da_study.getResults().prepare_to_pickle())
# Obligatoire ???
def finish(self):