Salome HOME
porting to SALOME 9.3: 2to3
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 22 May 2019 12:45:32 +0000 (14:45 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 22 May 2019 12:45:32 +0000 (14:45 +0200)
18 files changed:
src/HYDROGUI/BndConditionsDialog.py
src/HYDROGUI/HYDROSOLVERGUI.py
src/HYDROTools/boundaryConditions.py
src/HYDROTools/interpolS.py
src/salome_hydro/assignStrickler_gui.py
src/salome_hydro/boundary_conditions/eficas/boundary_conditions_cata.py
src/salome_hydro/generate_interpolz.py
src/salome_hydro/interpolz_gui.py
src/salome_hydro/param_study/eficas/appli.py
src/salome_hydro/param_study/eficas/param_study_cata.py
src/salome_hydro/run_study/eficas/appli.py
src/salome_hydro/run_study/eficas/run_study_cata.py
src/salome_hydro/run_study/gui.py
src/salome_hydro/run_study/launcher.py
src/salome_hydro/study.py
src/salome_hydro/telma/eficas/appli.py
src/salome_hydro/test_interpolz_gui.py
tests/boundaryConditionsTest.py

index b2783648a90e70e4ba09bb422bc12e13a64c7a27..e86b16cef973c7ba5cdb6e2c6273ae096b574585 100755 (executable)
@@ -39,7 +39,7 @@ def get_med_groups_on_edges(file_path):
         med_file_mesh = MEDFileMesh.New(file_path)
         groups = list(med_file_mesh.getGroupsOnSpecifiedLev(-1))
     except Exception as e:
-        print e.what()
+        print(e.what())
         return []
 
     return groups
@@ -48,7 +48,7 @@ def get_med_groups_on_edges(file_path):
 def get_preset_name(presets, lihbor, liubor, livbor, litbor):
     name = 'Custom'
     res = (lihbor, liubor, livbor, litbor)
-    for key, val in presets.iteritems():
+    for key, val in presets.items():
       if val == res:
         name = key
         break
@@ -180,18 +180,18 @@ class BoundaryConditionsDialog(QDialog):
     def on_apply(self):
         # Save boundary conditions file
         if not self.is_valid():
-            print 'Not valid'
+            print('Not valid')
             return False
 
         if self.sameAsInputCB.isChecked():
           file_path = self.bndConditionsFileEdit.text()
         else:
           file_path = self.resultBndConditionsFileEdit.text()
-        print 'File path:', file_path
+        print('File path:', file_path)
         writer = boundaryConditions.BoundaryConditionWriter(file_path)
 
         conditions = []
-        for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
+        for row_nb in range(0, self.boundaryConditionsTable.rowCount()):
             lihbor = str(self.boundaryConditionsTable.item(row_nb, 1).text())
             liubor = str(self.boundaryConditionsTable.item(row_nb, 2).text())
             livbor = str(self.boundaryConditionsTable.item(row_nb, 3).text())
@@ -260,7 +260,7 @@ class BoundaryConditionsDialog(QDialog):
 
         preset = str(combo.currentText())
 
-        if preset and self.presets.has_key(preset):
+        if preset and preset in self.presets:
             values = self.presets[preset]
             row_nb = combo.property(ROW_PROPERTY_NAME)
 
@@ -308,7 +308,7 @@ class BoundaryConditionsDialog(QDialog):
             combo = QComboBox(self)
             #combo.addItem('')
             if len(self.presets) > 0:
-                items = self.presets.keys()
+                items = list(self.presets.keys())
                 items.sort()
                 combo.addItems(items)
 
@@ -345,9 +345,9 @@ class BoundaryConditionsDialog(QDialog):
         is_updated = False
 
         nb_rows = self.boundaryConditionsTable.rowCount()
-        for row_nb in xrange(0, nb_rows):
+        for row_nb in range(0, nb_rows):
             group_name = str(self.boundaryConditionsTable.item(row_nb, 5).text())
-            if self.input_conditions.has_key(group_name):
+            if group_name in self.input_conditions:
                 
                 values = self.input_conditions[group_name]
                 #print values
@@ -393,7 +393,7 @@ class BoundaryConditionsDialog(QDialog):
         elif len(self.get_output_path())==0:
             QMessageBox.critical(self, self.tr("Insufficient input data"), self.tr("Output file path is empty."))
         else:
-            for row_nb in xrange(0, self.boundaryConditionsTable.rowCount()):
+            for row_nb in range(0, self.boundaryConditionsTable.rowCount()):
                 has_empty_cells = True
                 lihbor = str(self.boundaryConditionsTable.item(row_nb, 1).text())
                 liubor = str(self.boundaryConditionsTable.item(row_nb, 2).text())
index 4c4812cb82a4b8a90c72e2d41ab39b279d69855d..1e62aff348163ed0c9dab04a2a511d44ee9b0096 100755 (executable)
@@ -277,7 +277,7 @@ def _getContext():
 ###
 def _setContext(studyID):
     global __study2context__, __current_context__
-    if not __study2context__.has_key(studyID):
+    if studyID not in __study2context__:
         __study2context__[studyID] = GUIcontext()
         pass
     __current_context__ = __study2context__[studyID]
@@ -336,10 +336,10 @@ def createPopupMenu(popup, context):
 def OnGUIEvent(commandID):
     try:
         dict_command[commandID]()
-    except HSGUIException, exc:
+    except HSGUIException as exc:
         QMessageBox.critical(sgPyQt.getDesktop(),
                                    QApplication.translate("OnGUIEvent", "Error"),
-                                   unicode(exc))
+                                   str(exc))
     except:
         logger.exception("Unhandled exception caught in HYDROSOLVER GUI")
         msg = QApplication.translate("OnGUIEvent",
@@ -377,9 +377,9 @@ def generate_param_study_python():
             ed = hydro_study.HydroStudyEditor()
             sobj = get_and_check_selected_file_path()
             ed.generate_study_script(sobj)
-    except SALOME.SALOME_Exception, exc:
+    except SALOME.SALOME_Exception as exc:
         salome.sg.updateObjBrowser(0)
-        msg = unicode(QApplication.translate("generate_telemac2d_python",
+        msg = str(QApplication.translate("generate_telemac2d_python",
                       "An error happened while trying to generate telemac2d Python script:"))
         msg += "\n" + exc.details.text
         raise HSGUIException(msg)
@@ -393,9 +393,9 @@ def generate_param_study_yacs():
             ed = hydro_study.HydroStudyEditor()
             sobj = get_and_check_selected_file_path()
             ed.generate_study_yacs(sobj)
-    except SALOME.SALOME_Exception, exc:
+    except SALOME.SALOME_Exception as exc:
         salome.sg.updateObjBrowser(0)
-        msg = unicode(QApplication.translate("generate_telemac2d_yacs",
+        msg = str(QApplication.translate("generate_telemac2d_yacs",
                       "An error happened while trying to generate telemac2d Python script:"))
         msg += "\n" + exc.details.text
         raise HSGUIException(msg)
index c0907772d85469df0200459abe4b529698e21475..647c2984d0fbfaf31c8a399f1e9e51d09052a3c0 100644 (file)
@@ -39,7 +39,7 @@ class PresetReader():
                         self._errors.append("Line #%s: wrong number of values in the preset." % line_number)
                     elif values[0].strip() == "":
                         self._errors.append("Line #%s: empty name of the preset." % line_number)
-                    elif presets.has_key(values[0]):
+                    elif values[0] in presets:
                         self._errors.append("Line #%s: preset name %s is already used." % (line_number, values[0]))
                     else:
                         name = values[0]
index 8401a9645a306d057606408d60b7e8da2cd927e0..a2740eb132ff0f444ea095815e8e3947394acd00 100644 (file)
@@ -83,7 +83,7 @@ def assignStrickler(case_name, med_file_name, output_file_name, med_field_name='
                                medenum.MED_NODE, medenum.MED_NONE,
                                medenum.MED_FULL_INTERLACE, medenum.MED_ALL_CONSTITUENT, len(values), values)
                                                           
-      print "MED field '%s' on %s nodes has been created." % (med_field_name, nb_nodes)
+      print("MED field '%s' on %s nodes has been created." % (med_field_name, nb_nodes))
                                                         
   # close MED file
   medfile.MEDfileClose(fid)
\ No newline at end of file
index 9eb791d7750072095c61076fd4eeaa620ba29094..5d01d1d6fc14995fced557a19346bb6069d14094 100644 (file)
@@ -11,7 +11,7 @@ salome.salome_init()
 import HYDROPy
 from salome.hydrotools.interpolS import assignStrickler
 
-from generate_interpolz import replace
+from .generate_interpolz import replace
 
 from PyQt5.QtWidgets import QDialog, QFileDialog, QTableWidgetItem, QComboBox, QMessageBox
 from PyQt5 import uic
index 46f73dc5e1d26c83ee0e7772610e344d1a9a9f2f..4e0befe2aba063ff24fe9c86a119711afc855601 100644 (file)
@@ -25,7 +25,7 @@ class grma(GEOM):
   Method __convert__ is redefined to skip the test on the string length.
   """
   def __convert__(cls, valeur):
-    if isinstance(valeur, (str, unicode)):
+    if isinstance(valeur, str):
       return valeur.strip()
     raise ValueError(_('A string is expected'))
 
@@ -37,24 +37,24 @@ JdC = JDC_CATA(regles = (AU_MOINS_UN('BOUNDARY_CONDITION',)),
 
 BOUNDARY_CONDITION = PROC(
     nom = "BOUNDARY_CONDITION", op = None,
-    fr = u"Définition d'une condition limite pour Telemac2D",
-    ang = u"Definition of a boundary condition for Telemac2D",
+    fr = "Définition d'une condition limite pour Telemac2D",
+    ang = "Definition of a boundary condition for Telemac2D",
 
     GROUP = SIMP(statut = "o", typ = grma,
-                 fr = u"Groupe sur lequel la condition limite est définie",
-                 ang = u"Group on which the boundary condition is defined",
+                 fr = "Groupe sur lequel la condition limite est définie",
+                 ang = "Group on which the boundary condition is defined",
                 ),
     LIHBOR = SIMP(statut = "o", typ = "I",
-                  fr = u"Type de condition limite pour la hauteur d'eau",
-                  ang = u"Boundary condition type for the water height",
+                  fr = "Type de condition limite pour la hauteur d'eau",
+                  ang = "Boundary condition type for the water height",
                  ),
     LIUBOR = SIMP(statut = "o", typ = "I",
-                  fr = u"Type de condition limite pour la composante U de la vitesse",
-                  ang = u"Boundary condition type for the U component of the water velocity",
+                  fr = "Type de condition limite pour la composante U de la vitesse",
+                  ang = "Boundary condition type for the U component of the water velocity",
                  ),
     LIVBOR = SIMP(statut = "o", typ = "I",
-                  fr = u"Type de condition limite pour la composante V de la vitesse",
-                  ang = u"Boundary condition type for the V component of the water velocity",
+                  fr = "Type de condition limite pour la composante V de la vitesse",
+                  ang = "Boundary condition type for the V component of the water velocity",
                  ),
 )
 TEXTE_NEW_JDC="BOUNDARY_CONDITION()"
index 93b22dd7952cead5deede73226ebf27ef326b553..cb2f9becd45f165b42b2a7486d7e8c2ae0980637 100644 (file)
@@ -15,7 +15,7 @@ def replace( lines, pattern, subst ):
         del lines[i]
         name = pattern[1:-1]
         lines.insert( i, "%s = {}\n" % name )
-        keys = subst.keys()
+        keys = list(subst.keys())
         keys.sort()
         i = i+1
         for k in keys:
index 16e06c5b1a61f23a9b9f4acc0e51ece60c3d5a11..87907c86812a22eea79a5776e38d904dfad97855 100644 (file)
@@ -23,7 +23,7 @@ import SalomePyQt
 import libSALOME_Swig
 salome_gui = libSALOME_Swig.SALOMEGUI_Swig()
 
-from generate_interpolz import generate, generate_B
+from .generate_interpolz import generate, generate_B
 
 def get_med_groups( file_path ):
     #print "get_med_groups", file_path
@@ -31,24 +31,24 @@ def get_med_groups( file_path ):
         #meshes = MEDLoader.GetMeshNames(file_path)
         (meshes, status) = smesh.CreateMeshesFromMED(file_path)
     except:
-        print 'No meshes found'
+        print('No meshes found')
         return []
     if len(meshes)==0:
-        print 'No mesh found'
+        print('No mesh found')
         return []
     mesh1 = meshes[0]
-    print 'Found mesh:', mesh1
+    print('Found mesh:', mesh1)
     try:
         #groups = list(MEDLoader.GetMeshGroupsNames(file_path, mesh1))
         grps = mesh1.GetGroups()
         groups = [grp.GetName() for grp in grps if grp.GetType() == SMESH.FACE]
         if len(groups) == 0:
-          print "Problem! There are no groups of faces in the mesh!"
-          print "Please create at least the groups of faces corresponding to each region of the HYDRO case"
+          print("Problem! There are no groups of faces in the mesh!")
+          print("Please create at least the groups of faces corresponding to each region of the HYDRO case")
           return []
-        print 'Found groups:', groups
+        print('Found groups:', groups)
     except:
-        print 'No groups found'
+        print('No groups found')
         return []
     return groups
 
@@ -159,7 +159,7 @@ class InterpolzDlg( QDialog ):
 
     def onMEDChanged( self ):
       self.med_groups = get_med_groups( str(self.MEDFile.text()) )
-      print self.med_groups
+      print(self.med_groups)
       n = len( self.med_groups )
       self.Groups.setRowCount( n )
       self.medGroupNames.clear()
@@ -208,7 +208,7 @@ class InterpolzDlg( QDialog ):
     def onApply( self ):
         path = str(self.OutputPath.text())
         med_file = str(self.MEDFile.text())
-        print 'current  TAB = ', self.tabWidget.currentIndex()
+        print('current  TAB = ', self.tabWidget.currentIndex())
         if self.tabWidget.currentIndex() == 0: #calc case tab
             calc_case = str(self.CalcCase.text())
             med_groups_regions = {}
index a4411d4386fd25c05f72b616ef1934d1e874447e..9a5d017d408aa9f5de1c732af9cf4a36a6af2c5b 100644 (file)
@@ -82,7 +82,7 @@ class EficasForParamStudyAppli(eficasSalome.MyEficas):
         """
         try:
             self.ed.find_or_create_param_study(jdcPath)
-        except Exception, exc:
+        except Exception as exc:
             msgError = "Can't add file to Salome study tree"
             logger.exception(msgError)
             QMessageBox.warning(self, self.tr("Warning"),
index c95ea1cf63736d4e62d251557cee7836ad818fa8..ab9e09ca5ce43f469f7c4defdd8ac186179c1452 100644 (file)
@@ -47,7 +47,7 @@ class Tuple:
     self.ntuple=ntuple
 
   def __convert__(self,valeur):
-    if type(valeur) == types.StringType:
+    if type(valeur) == bytes:
       return None
     if len(valeur) != self.ntuple:
       return None
@@ -66,75 +66,75 @@ JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)),
 
 TELEMAC2D = PROC(
     nom = "TELEMAC2D", op = None,
-    fr = u"Définition d'un cas d'étude Telemac2D",
-    ang = u"Definition of a Telemac2D study case",
+    fr = "Définition d'un cas d'étude Telemac2D",
+    ang = "Definition of a Telemac2D study case",
     STEERING_FILE = SIMP(statut = "o", typ = 'Fichier',
-                       fr = u"Fichier de description du cas",
-                       ang = u"Case description file",
+                       fr = "Fichier de description du cas",
+                       ang = "Case description file",
     ),
     USER_FORTRAN = SIMP(statut = "f", typ = 'FichierOuRepertoire',
                         fr = "Fichier Fortran utilisateur",
-                        ang = u"Fortran user file",
+                        ang = "Fortran user file",
     ),
     WORKING_DIRECTORY = SIMP(statut = "o", typ = 'Repertoire',
                              defaut = '/tmp',
                              fr = "Repertoire de travail",
-                             ang = u"Working directory user file",
+                             ang = "Working directory user file",
     ),
     RESULT_DIRECTORY = SIMP(statut = "f", typ = 'Repertoire',
                             fr = "Repertoire de travail",
-                            ang = u"Working directory user file",
+                            ang = "Working directory user file",
     ),
     RESULTS_FILE_NAME = SIMP(statut = "f", typ = 'TXM',
-                             fr = u"Fichier des resultats (Ecrasera celui dans le fichier cas)",
-                             ang = u"Results file (Will replace the one in the steering file)"
+                             fr = "Fichier des resultats (Ecrasera celui dans le fichier cas)",
+                             ang = "Results file (Will replace the one in the steering file)"
     ),
     Consigne = SIMP(statut ="o", homo="information", typ="TXM",
                     defaut = "All index are in Python numbering (Starting from 0)",
     ),
     INPUT_VARIABLE = FACT(statut = 'f', max = '**',
-                          fr = u"Variable d'entrée du calcul",
-                          ang = u"Computation input variable",
+                          fr = "Variable d'entrée du calcul",
+                          ang = "Computation input variable",
 
         NAME = SIMP(statut = "o", typ = 'TXM',
-                    fr = u"Nom de la variable (format Python)",
-                    ang = u"Variable name (Python format)"
+                    fr = "Nom de la variable (format Python)",
+                    ang = "Variable name (Python format)"
         ),
         VAR_INFO = FACT(statut = "o",
-                        fr = u'Variable du modèle Telemac2D',
-                        ang = u'Telemac2D model variable',
+                        fr = 'Variable du modèle Telemac2D',
+                        ang = 'Telemac2D model variable',
 
             VAR_NAME = SIMP(statut = "o", typ = 'TXM',
                             intoSug = get_list_var_api('TELEMAC2D'),
-                            fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
-                            ang = u'Model variable name (ex: "MODEL.DEBIT")'
+                            fr = 'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
+                            ang = 'Model variable name (ex: "MODEL.DEBIT")'
             ),
             DEFAULT_VALUE = SIMP(statut = "o", typ = 'TXM',
-                                 fr = u'Valeur par défaut',
-                                 ang = u'Default value',
+                                 fr = 'Valeur par défaut',
+                                 ang = 'Default value',
             ),
             ZONE_DEF = FACT(statut = "o",
-                            ang = u'Variable definition area',
-                            fr = u'Zone de définition de la variable',
+                            ang = 'Variable definition area',
+                            fr = 'Zone de définition de la variable',
 
                 TYPE = SIMP(statut = "o", typ = 'TXM',
                             into = ['INDEX', 'RANGE', 'POLYGON', 'POLYGON_FILE'],
                             fenetreIhm="menuDeroulant",
-                            fr = u'Type de definition de la variable',
-                            ang = u'Type of definition for the variable',
+                            fr = 'Type de definition de la variable',
+                            ang = 'Type of definition for the variable',
                 ),
 
                 b_INDEX = BLOC(condition = "TYPE == 'INDEX'",
                     INDEX = SIMP(statut = "o", typ = Tuple(3),
                                  defaut = (0, 0, 0),
                                  ang = "Index of the variable",
-                                 fr = u"Indice de la variable",
+                                 fr = "Indice de la variable",
                                  validators = VerifTypeTuple(('I', 'I', 'I')),
                     ),
                 ),
                 b_RANGE = BLOC(condition = "TYPE == 'RANGE'",
                     RANGE = SIMP(statut = "o", typ = 'TXM',
-                                 fr = u"Liste d'index pour des tableaux à une dimension ex: [1,3:8,666]",
+                                 fr = "Liste d'index pour des tableaux à une dimension ex: [1,3:8,666]",
                                  ang = "Range of index for one dimension arrays ex: [1,3:8,666]",
                     ),
                     Consigne = SIMP(statut ="o", homo="information", typ="TXM",
@@ -145,8 +145,8 @@ TELEMAC2D = PROC(
                     POLYGON = SIMP(statut = "o",
                                    typ = Tuple(2),
                                    max = '**',
-                                   fr = u"Liste des sommets (coordonnées X,Y) du "
-                                        u"polygone définissant le contour de la zone",
+                                   fr = "Liste des sommets (coordonnées X,Y) du "
+                                        "polygone définissant le contour de la zone",
                                    ang = "List of points (X,Y coordinates) of the "
                                          "polygon defining the border of the area",
                                    validators = VerifTypeTuple(('R', 'R')),
@@ -154,15 +154,15 @@ TELEMAC2D = PROC(
                 ),
                 b_POLYGON_FILE = BLOC(condition = "TYPE == 'POLYGON_FILE'",
                     POLYGON_FILE = FACT(statut = "o",
-                                        fr = u"Polygon dans un fichier",
+                                        fr = "Polygon dans un fichier",
                                         ang = "Polygone in a file",
                         FILE_NAME = SIMP(statut = "o", typ = 'Fichier',
-                                         fr = u"Fichier contenant les info du polygone",
+                                         fr = "Fichier contenant les info du polygone",
                                          ang = "File containing the polygon info",
                         ),
                         SEPARATOR = SIMP(statut = "o", typ = 'TXM',
                                          defaut = ',',
-                                         fr = u"Separateur pour le fichier de polygone",
+                                         fr = "Separateur pour le fichier de polygone",
                                          ang = "Separator for the polygon file",
                         ),
                     ),
@@ -171,27 +171,27 @@ TELEMAC2D = PROC(
         ),
     ),
     OUTPUT_VARIABLE = FACT(statut = 'f', max = '**',
-                           fr = u"Variable de sortie du calcul",
-                           ang = u"Computation output variable",
+                           fr = "Variable de sortie du calcul",
+                           ang = "Computation output variable",
         NAME = SIMP(statut = "o", typ = 'TXM',
-                   fr = u"Nom de la variable",
-                   ang = u"Variable name",
+                   fr = "Nom de la variable",
+                   ang = "Variable name",
         ),
         VAR_INFO = FACT(statut = "o",
-                        fr = u'Variable du modèle Telemac2D',
-                        ang = u'Telemac2D model variable',
+                        fr = 'Variable du modèle Telemac2D',
+                        ang = 'Telemac2D model variable',
             VAR_NAME = SIMP(statut = "o", typ = 'TXM',
                             intoSug = get_list_var_api('TELEMAC2D'),
-                            fr = u'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
-                            ang = u'Model variable name (ex: "MODEL.DEBIT")',
+                            fr = 'Nom de la variable du modèle (ex: "MODEL.DEBIT")',
+                            ang = 'Model variable name (ex: "MODEL.DEBIT")',
             ),
             ZONE_DEF = FACT(statut = "o",
-                            ang = u'Variable definition area',
-                            fr = u'Zone de définition de la variable',
+                            ang = 'Variable definition area',
+                            fr = 'Zone de définition de la variable',
                 INDEX = SIMP(statut = "o", typ = Tuple(3),
                              defaut = (0, 0, 0, ),
                              ang = "Index of the point / border",
-                             fr = u"Indice du point ou de la frontière",
+                             fr = "Indice du point ou de la frontière",
                              validators = VerifTypeTuple(('I', 'I', 'I')),
                 ),
             ),
index 874cc99e06a79e0f96f6d1ca64360f596ef14174..2446044a16ef55844b5b12b2c0d7e46fd3208abb 100755 (executable)
@@ -65,7 +65,7 @@ class EficasForRunStudyAppli(eficasSalome.MyEficas):
         """
         try:
             self.ed.find_or_create_run_study(jdcPath)
-        except Exception, exc:
+        except Exception as exc:
             msgError = "Can't add file to Salome study tree"
             logger.exception(msgError)
             QMessageBox.warning(self, self.tr("Warning"),
index 8c1e9f819f3a34917576ae9f7072aaa734504d16..64d5f3e98bc8ad3c4c68490e2645091c34764afa 100644 (file)
@@ -25,17 +25,17 @@ JdC = JDC_CATA(regles = (UN_PARMI('RUN_STUDY',)),
                         )
 RUN_STUDY = PROC(
     nom = "RUN_STUDY", op = None,
-    fr = u"Définition d'un cas pour le lanceur Python",
-    ang = u"Definition of a case for the Python launcher",
+    fr = "Définition d'un cas pour le lanceur Python",
+    ang = "Definition of a case for the Python launcher",
     CODE = SIMP(statut = "o", typ = "TXM", into = codelist, defaut = "telemac2d",
-                fr = u"Code à exécuter",
-                ang = u"Code to run"),
+                fr = "Code à exécuter",
+                ang = "Code to run"),
     FICHIER_CAS = SIMP(statut = "o", typ = 'Fichier',
-                       fr = u"Fichier de description du cas",
-                       ang = u"Case description file"),
+                       fr = "Fichier de description du cas",
+                       ang = "Case description file"),
     REPERTOIRE_TRAVAIL = SIMP(statut = "f", typ = 'Repertoire',
-                              fr = u"Répertoire de travail",
-                              ang = u"Working directory"),
+                              fr = "Répertoire de travail",
+                              ang = "Working directory"),
 )
 
 TEXTE_NEW_JDC="RUN_STUDY()"
index 0a3e9f2f8533dd0afa0f382626a2c9f013af5fd9..94be8735a12d94a11cf760915ad54cf528b1b9b6 100755 (executable)
@@ -22,8 +22,8 @@ from salome.hydro.gui_utils import get_and_check_selected_file_path
 from salome.hydro.study import jdc_to_dict
 
 from salome.hydro.run_study.eficas.appli import EficasForRunStudyAppli
-from launcher import run_study
-from genjobwindow import GenJobDialog
+from .launcher import run_study
+from .genjobwindow import GenJobDialog
 
 from PyQt5.QtWidgets import  QFileDialog
 
index 3702551024ca279aa0620bc5747a600e5ecad2fd..b1ee58c7197133cfdd9022392d9d4017c71a0e71 100644 (file)
@@ -63,7 +63,7 @@ def run_study(param_dict):
   # Launch the command
   logger.debug("Running the following command in xterm: %s" % cmd)
   args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "-hold", "-l", "-e", cmd]
-  if param_dict.has_key('batchExec'):
+  if 'batchExec' in param_dict:
     if param_dict['batchExec'] == True:
       args = ["xterm", "-T", "Execution of Telemac", "-geo", "80x60", "+hold", "-l", "-e", cmd]
   subprocess.Popen(args, cwd = wrkdir)
index f4983b71ba589af19c3e43320b7fc3f13c0c1ae0..dd066ee917baa32b40580cb4e063b3b80b0ff3d9 100644 (file)
@@ -52,16 +52,16 @@ def jdc_to_dict(jdc, command_list):
     context = {}
     for command in command_list:
         context[command] = _args_to_dict
-    exec "parameters = " + jdc.strip() in context
+    exec("parameters = " + jdc.strip(), context)
     return context['parameters']
 
 def _args_to_dict(**kwargs):
     return kwargs
 
 def get_jdc_dict_var_as_tuple(jdc_dict, varname):
-    if not jdc_dict.has_key(varname):
+    if varname not in jdc_dict:
         return tuple()
-    elif not isinstance(jdc_dict[varname], types.TupleType):
+    elif not isinstance(jdc_dict[varname], tuple):
         return (jdc_dict[varname],)
     else:
         return jdc_dict[varname]
index b4a9461c6ceafa66d980635dd13e4fba9071154f..ca24c63bbf557e9f8676ecd2377fb225015ddc58 100755 (executable)
@@ -81,7 +81,7 @@ class EficasForTelmaAppli(eficasSalome.MyEficas):
         """
         try:
             self.ed.find_or_create_telma(jdcPath)
-        except Exception, exc:
+        except Exception as exc:
             msgError = "Can't add file to Salome study tree"
             logger.exception(msgError)
             QMessageBox.warning(self, self.tr("Warning"),
index f92d53e80737850ddb9c0b4cf2fe467b10173e97..19880eb0530b39a2d974246e1a18252b23fba743 100644 (file)
@@ -1,5 +1,5 @@
 
-from interpolz_gui import InterpolzDlg
+from .interpolz_gui import InterpolzDlg
 
 dlg = InterpolzDlg()
 dlg.show()
index bcdba0741bf0f2286f353082c910e03f7a945754..238413f48c75e0126ca58b5ea079a3c310ccfdb2 100644 (file)
@@ -20,13 +20,13 @@ class TestBoundaryConditions(unittest.TestCase):
         presets = reader.read()
         self.assertEqual(3, len(presets))
 
-        self.assertEqual(True, presets.has_key("Closed boundaries/walls"))
+        self.assertEqual(True, "Closed boundaries/walls" in presets)
         self.assertEqual((2,2,2,2), presets["Closed boundaries/walls"])
 
-        self.assertEqual(True, presets.has_key("Incident waves"))
+        self.assertEqual(True, "Incident waves" in presets)
         self.assertEqual((1,1,1,None), presets["Incident waves"])
 
-        self.assertEqual(True, presets.has_key("Free T"))
+        self.assertEqual(True, "Free T" in presets)
         self.assertEqual((None,None,None,4), presets["Free T"])
 
     def testRead(self):