Salome HOME
[PY3] 2to3 -w -n results
authorNicolas Geimer <nicolas.geimer@edf.fr>
Tue, 21 Mar 2017 10:49:02 +0000 (11:49 +0100)
committerNicolas Geimer <nicolas.geimer@edf.fr>
Tue, 21 Mar 2017 10:49:02 +0000 (11:49 +0100)
48 files changed:
Demo/xmlrpcprog_orig.py
Misc/doxy2swig.py
doc/exemples/exemple2/exmpl.py
doc/exemples/exemple3/use.py
doc/exemples/exemple8/client.py
src/evalyfx_swig/test3.py
src/py2yacs/py2yacs.py
src/pyqt/gui/Appli.py
src/pyqt/gui/BoxManager.py
src/pyqt/gui/CItems.py
src/pyqt/gui/CONNECTOR.py
src/pyqt/gui/GraphViewer.py
src/pyqt/gui/Icons.py
src/pyqt/gui/Item.py
src/pyqt/gui/Items.py
src/pyqt/gui/PanelManager.py
src/pyqt/gui/Tree.py
src/pyqt/gui/adapt.py
src/pyqt/gui/browser.py
src/pyqt/gui/browser_catalog.py
src/pyqt/gui/browser_session.py
src/pyqt/gui/cataitems.py
src/pyqt/gui/catalog.py
src/pyqt/gui/graph.py
src/pyqt/gui/panels.py
src/pyqt/gui/sessions.py
src/salomeloader/ElementTree.py
src/salomeloader/graph.py
src/salomeloader/salomeloader.py
src/wrappergen/bin/Cpp_Template__SRC/src/Cpp_Template_/Cpp_Template__TEST/Cpp_Template__test.py
src/wrappergen/bin/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/wrappergen/src/HXX2SALOME_GENERIC_CLASS_NAME_SRC/bin/runSalome.py
src/yacsloader/Test/algoasyncexample.py
src/yacsloader/Test/algosyncexample.py
src/yacsloader/Test/echoclt.py
src/yacsloader/Test/genPascal.py
src/yacsloader/Test/genTriangle.py
src/yacsloader/Test/optim_plugin.py
src/yacsloader_swig/Test/optim_plugin.py
src/yacsloader_swig/Test/testEdit.py
src/yacsloader_swig/Test/testExec.py
src/yacsloader_swig/Test/testLoader.py
src/yacsloader_swig/Test/testRefcount.py
src/yacsloader_swig/Test/testResume.py
src/yacsloader_swig/Test/testSave.py
src/yacsloader_swig/Test/testSaveLoadRun.py
src/yacsorb/CORBAEngineTest.py
src/yacsorb/YACS.py

index fa4fde57e145e7ce9402c4faa43a9e2a47ba9c53..b0c0c330eb2738172e4edd1cca9848b75d9a8b0a 100755 (executable)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import xmlrpclib,sys
+import xmlrpc.client,sys
 
 data="""
 <methodCall>
@@ -31,14 +31,14 @@ data="""
 </methodCall>
 """
 def echo(args):
-  print args
+  print(args)
   return 96785439
 
 f=open("input")
 data=f.read()
 f.close()
 
-params, method = xmlrpclib.loads(data)
+params, method = xmlrpc.client.loads(data)
 
 try:
    call=eval(method)
@@ -46,11 +46,11 @@ try:
    response = (response,)
 except:
    # report exception back to server
-   response = xmlrpclib.dumps( xmlrpclib.Fault(1, "%s:%s" % sys.exc_info()[:2]))
+   response = xmlrpc.client.dumps( xmlrpc.client.Fault(1, "%s:%s" % sys.exc_info()[:2]))
 else:
-   response = xmlrpclib.dumps( response, methodresponse=1)
+   response = xmlrpc.client.dumps( response, methodresponse=1)
 
-print response
+print(response)
 f=open("output",'w')
 f.write(response)
 f.close()
index e4fafe57df91aca33b9cd0bc5c12a051ca0ff471..b6fe059038ef91849938c1604b9e0118fc238194 100644 (file)
@@ -168,7 +168,7 @@ class Doxy2SWIG:
 
     def add_text(self, value):
         """Adds text corresponding to `value` into `self.pieces`."""
-        if type(value) in (types.ListType, types.TupleType):
+        if type(value) in (list, tuple):
             self.pieces.extend(value)
         else:
             self.pieces.append(value)
@@ -228,17 +228,17 @@ class Doxy2SWIG:
         kind = node.attributes['kind'].value
         if kind in ('class', 'struct'):
             prot = node.attributes['prot'].value
-            if prot <> 'public':
+            if prot != 'public':
                 return
             names = ('compoundname', 'briefdescription',
                      'detaileddescription', 'includes')
             first = self.get_specific_nodes(node, names)
             for n in names:
-                if first.has_key(n):
+                if n in first:
                     self.parse(first[n])
             self.add_text(['";','\n'])
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
         elif kind in ('file', 'namespace'):
             nodes = node.getElementsByTagName('sectiondef')
@@ -251,7 +251,7 @@ class Doxy2SWIG:
 
     def do_parameterlist(self, node):
         text='unknown'
-        for key, val in node.attributes.items():
+        for key, val in list(node.attributes.items()):
             if key == 'kind':
                 if val == 'param': text = 'Parameters'
                 elif val == 'exception': text = 'Exceptions'
@@ -298,7 +298,7 @@ class Doxy2SWIG:
             if name[:8] == 'operator': # Don't handle operators yet.
                 return
 
-            if not first.has_key('definition') or \
+            if 'definition' not in first or \
                    kind in ['variable', 'typedef']:
                 return
 
@@ -326,7 +326,7 @@ class Doxy2SWIG:
                 self.add_text(' %s::%s "\n%s'%(cname, name, defn))
 
             for n in node.childNodes:
-                if n not in first.values():
+                if n not in list(first.values()):
                     self.parse(n)
             self.add_text(['";', '\n'])
         
@@ -390,7 +390,7 @@ class Doxy2SWIG:
             if not os.path.exists(fname):
                 fname = os.path.join(self.my_dir,  fname)
             if not self.quiet:
-                print "parsing file: %s"%fname
+                print("parsing file: %s"%fname)
             p = Doxy2SWIG(fname, self.include_function_definition, self.quiet)
             p.generate()
             self.pieces.extend(self.clean_pieces(p.pieces))
index c1a49596ec7076620a84b19c4dc1242c4be94f44..7decb00cd223206dd6c69af7fba75d5b089da038 100755 (executable)
@@ -10,8 +10,8 @@ for i in range(5):
 C = compo.compo()
     
 z = C.addvec(x, y)
-print 'x = ', x
-print 'y = ', y
-print 'z = ', z
-print C.prdscl(x,y)
+print('x = ', x)
+print('y = ', y)
+print('z = ', z)
+print(C.prdscl(x,y))
 
index 7ff59df58854c8edca49b941bf5d88931da4be2c..f916b07406d56024bb97ccd442b4b490caec5061 100755 (executable)
@@ -2,18 +2,18 @@ import systeme
 
 S = systeme.Systeme()
 
-print "create U1 ..."
+print("create U1 ...")
 S.touch('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "copy U1 to U2 ..."
+print("copy U1 to U2 ...")
 S.cp('U1', 'U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U1 ..."
+print("delete U1 ...")
 S.rm('U1')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
 
-print "delete U2 ..."
+print("delete U2 ...")
 S.rm('U2')
-print "dir : ", S.dir()
+print("dir : ", S.dir())
index ba2b9d971f68e07acf65488ca94815ab7a79142e..104617db24426557316954590a27f5881d697dc2 100755 (executable)
@@ -16,6 +16,6 @@ v1 = [ 1, 2, 3 ]
 v2 = [ 3, 4, 5 ]
 
 v3 = o.addvec(v1, v2)
-print v3
+print(v3)
 
-print o.prdscl(v1, v3)
+print(o.prdscl(v1, v3))
index 9fd10cc45564e6cd715831476d45ef94e5a7922f..4bb752016ebe6442de7593a2a28c66f09e658529 100644 (file)
@@ -68,5 +68,5 @@ cp=rss.getAddParamsForCluster() ; cp.setRemoteWorkingDir(os.path.join("/scratch"
 cp.setWCKey("P11U50:CARBONES") ; cp.setNbProcs(5) ; cp.setMaxDuration("00:05")
 assert(not rss.isInteractive())
 a,b=efx.run(session)
-print("************",a,b)
-print efx.getResults()
+print(("************",a,b))
+print(efx.getResults())
index 84ac997f000315bbeeaf2f65d31f73df0d3e2dbf..2e372aab64f0bb8429690b82ecf248dba9a333f7 100644 (file)
@@ -184,9 +184,9 @@ if __name__ == '__main__':
   
   fn_name = args.def_name
   functions,errors = get_properties(text_file)
-  print "global errors:", errors
+  print("global errors:", errors)
   for f in functions:
-    print f
+    print(f)
   
   fn_properties = next((f for f in functions if f.name == fn_name), None)
   if fn_properties is not None :
@@ -195,7 +195,7 @@ if __name__ == '__main__':
                        fn_properties.inputs, fn_properties.outputs,
                        args.output)
     else:
-      print "\n".join(fn_properties.errors)
+      print("\n".join(fn_properties.errors))
   else:
-    print "Function not found:", fn_name
+    print("Function not found:", fn_name)
   
\ No newline at end of file
index a3022e7f695b14cc77bd75840e6faa5cea5f0e8d..62868d720e0248c5b68ef95ba197c9b7cf89019d 100644 (file)
 """
 import sys,os
 from qt import *
-import Tree
-import PanelManager
-import BoxManager
-import Icons
-import Items
-import adapt
-import Item
-import logview
+from . import Tree
+from . import PanelManager
+from . import BoxManager
+from . import Icons
+from . import Items
+from . import adapt
+from . import Item
+from . import logview
 import pilot
 import threading
 import time
-import CONNECTOR
-import catalog
+from . import CONNECTOR
+from . import catalog
 import traceback
 import glob
 
@@ -55,7 +55,7 @@ class Runner(threading.Thread):
   def run(self):
     try:
       self.executor.RunW(self.proc,0)
-    except ValueError,ex:
+    except ValueError as ex:
       #traceback.print_exc()
       QApplication.postEvent(self.parent, ErrorEvent('YACS execution error',str(ex)))
 
@@ -467,7 +467,7 @@ class Appli(QMainWindow):
 
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Appli()
   t.objectBrowser.additem(Item("item1"))
index e4e93427850752109fa01011c8656db4af1980a5..bb3c67eec91975ed3e3acb2c82e7f50072f165e3 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class BoxManager(QWidgetStack):
   """ A BoxManager manages a collection of widget 
@@ -35,7 +35,7 @@ class BoxManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"selected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       CONNECTOR.Connect(item,"changed",self.changePanel,(item,))
       panel=item.box(self)
       self.panels[item]=panel
@@ -43,8 +43,8 @@ class BoxManager(QWidgetStack):
     self.raiseWidget(self.panels[item])
 
   def changePanel(self,item):
-    print "changePanel",item
-    if self.panels.has_key(item):
+    print("changePanel",item)
+    if item in self.panels:
       self.removeWidget(self.panels[item])
     panel=item.box(self)
     self.panels[item]=panel
index 2ea6be76cf3130882db7fe0f291b0ca06c4a5fd5..6d5c60561daddc54bd358300466c96434dff3823 100644 (file)
@@ -22,7 +22,7 @@ from qt import *
 from qtcanvas import *
 import pilot
 import pypilot
-import Item
+from . import Item
 import math
 
 dispatcher=pilot.Dispatcher.getDispatcher()
@@ -246,7 +246,7 @@ class LinkItem:
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -293,10 +293,10 @@ class ControlItem(QCanvasRectangle):
     return menu
 
   def connect(self):
-    print "ControlItem.connect",self.context
-    print self.port
+    print("ControlItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     item.connect()
     self.context.connecting(item)
     #self.context.connecting(self)
@@ -305,7 +305,7 @@ class ControlItem(QCanvasRectangle):
     #Protocol to link 2 objects (ports, at first)
     #First, notify the canvas View (or any view that can select) we are connecting (see method connect above)
     #Second (and last) make the link in the link method of object that was declared connecting
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), self.width(), self.height())
@@ -331,7 +331,7 @@ class InControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutControlItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -358,7 +358,7 @@ class OutControlItem(ControlItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InControlItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -405,15 +405,15 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "PortItem.connect",self.context
-    print self.port
+    print("PortItem.connect",self.context)
+    print(self.port)
     item=Item.adapt(self.port)
-    print item
+    print(item)
     self.context.connecting(item)
     #self.context.connecting(self)
 
   def link(self,obj):
-    print "PortItem.link:",obj
+    print("PortItem.link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(),pos.y(),self.width(), self.height())
@@ -440,7 +440,7 @@ class InPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -461,7 +461,7 @@ class OutPortItem(PortItem):
   def link(self,obj):
     #Here we create the link between self and obj.
     #self has been declared connecting in connect method
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -588,7 +588,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
       color= self.colors.get(color,Qt.white)
       self.setBrush(QBrush(color))
     else:
-      print "Unknown custom event type:", event.type()
+      print("Unknown custom event type:", event.type())
 
   def moveBy(self,dx,dy):
     QCanvasRectangle.moveBy(self,dx,dy)
@@ -624,7 +624,7 @@ class Cell(QCanvasRectangle,pypilot.PyObserver):
     #QToolTip(view).tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
     """The canvas item has been selected"""
index d369031737bba4f494877a85ecb445e92918d459..fe19e8b5f54f9de702d9d9f3e07f6f1abcccc223 100644 (file)
@@ -51,12 +51,12 @@ class CONNECTOR:
   def Connect(self, object, channel, function, args):
     ###print "Connect",object, channel, function, args
     idx = id(object)
-    if self.connections.has_key(idx):
+    if idx in self.connections:
        channels = self.connections[idx]
     else:
        channels = self.connections[idx] = {}
 
-    if channels.has_key(channel):
+    if channel in channels:
        receivers = channels[channel]
     else:
        receivers = channels[channel] = []
@@ -75,8 +75,7 @@ class CONNECTOR:
     try:
        receivers = self.connections[id(object)][channel]
     except KeyError:
-       raise ConnectorError, \
-            'no receivers for channel %s of %s' % (channel, object)
+       raise ConnectorError('no receivers for channel %s of %s' % (channel, object))
 
     for funct,fargs in receivers[:]:
         if funct() is None:
@@ -94,9 +93,8 @@ class CONNECTOR:
                  del self.connections[id(object)]
            return
 
-    raise ConnectorError,\
-          'receiver %s%s is not connected to channel %s of %s' \
-          % (function, args, channel, object)
+    raise ConnectorError('receiver %s%s is not connected to channel %s of %s' \
+          % (function, args, channel, object))
 
 
   def Emit(self, object, channel, *args):
@@ -112,7 +110,7 @@ class CONNECTOR:
        try:
           func=rfunc()
           if func:
-             apply(func, args + fargs)
+             func(*args + fargs)
           else:
              # Le receveur a disparu
              if (rfunc,fargs) in receivers:receivers.remove((rfunc,fargs))
@@ -127,8 +125,8 @@ def ref(target,callback=None):
 
 class BoundMethodWeakref(object):
    def __init__(self,callable):
-       self.Self=weakref.ref(callable.im_self)
-       self.Func=weakref.ref(callable.im_func)
+       self.Self=weakref.ref(callable.__self__)
+       self.Func=weakref.ref(callable.__func__)
 
    def __call__(self):
        target=self.Self()
@@ -146,27 +144,27 @@ if __name__ == "__main__":
    class A:pass
    class B:
      def add(self,a):
-       print "add",self,a
+       print("add",self,a)
      def __del__(self):
-       print "__del__",self
+       print("__del__",self)
 
    def f(a):
-     print f,a
-   print "a=A()"
+     print(f,a)
+   print("a=A()")
    a=A()
-   print "b=B()"
+   print("b=B()")
    b=B()
-   print "c=B()"
+   print("c=B()")
    c=B()
    Connect(a,"add",b.add,())
    Connect(a,"add",b.add,())
    Connect(a,"add",c.add,())
    Connect(a,"add",f,())
    Emit(a,"add",1)
-   print "del b"
+   print("del b")
    del b
    Emit(a,"add",1)
-   print "del f"
+   print("del f")
    del f
    Emit(a,"add",1)
    Disconnect(a,"add",c.add,())
index fd14ca4e7323a435336415e6d93f6e46b1964d42..418f1e66172a3dee759009bbb7900417a35867cb 100644 (file)
@@ -162,7 +162,7 @@ class GraphViewer(QCanvasView):
     #self.canvas().update()
 
   def addNode(self):
-    print "addNode"    
+    print("addNode")    
 
   def zoomIn(self):
     m = self.worldMatrix()
@@ -184,7 +184,7 @@ class GraphViewer(QCanvasView):
 
   def connecting(self,obj):
     """Method called by an item to notify canvasView a connection has begun"""
-    print "connecting",obj
+    print("connecting",obj)
     self.__connecting=obj
 
   def contentsMouseMoveEvent(self,e):
@@ -270,7 +270,7 @@ class LinkItem(QCanvasLine):
     return menu
 
   def delete(self):
-    print "delete link"
+    print("delete link")
 
   def tooltip(self,view,pos):
     r = QRect(pos.x(), pos.y(), pos.x()+10, pos.y()+10)
@@ -304,11 +304,11 @@ class PortItem(QCanvasEllipse):
     return menu
 
   def connect(self):
-    print "connect",self.context
+    print("connect",self.context)
     self.context.connecting(self)
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
 
   def tooltip(self,view,pos):
     r = QRect(self.x(), self.y(), self.width(), self.height())
@@ -326,7 +326,7 @@ class InPortItem(PortItem):
       link.setToPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,OutPortItem):
       #Connection possible
       l=LinkItem(obj,self,self.canvas())
@@ -345,7 +345,7 @@ class OutPortItem(PortItem):
       link.setFromPoint( int(self.x()), int(self.y()) )
 
   def link(self,obj):
-    print "link:",obj
+    print("link:",obj)
     if isinstance(obj,InPortItem):
       #Connection possible
       l=LinkItem(self,obj,self.canvas())
@@ -399,10 +399,10 @@ class Cell(QCanvasRectangle):
     view.tip( r, s )
 
   def browse(self):
-    print "browse"
+    print("browse")
 
   def selected(self):
-    print "selected"
+    print("selected")
 
 if __name__=='__main__':
   app=QApplication(sys.argv)
index 3d3b56fb88e59c3954df203b212aacd3b5b0caa5..d85460100d17e9eb5f6322c194197e4bc8b59522 100644 (file)
 
 import os
 from qt import QPixmap
-from imagesxpm import dico_xpm
+from .imagesxpm import dico_xpm
 
 dico_images={}
 
 def get_image(name):
-  if dico_images.has_key(name):
+  if name in dico_images:
     return dico_images[name]
   else :
-    if dico_xpm.has_key(name):
+    if name in dico_xpm:
       image=QPixmap(dico_xpm[name])
     else:
       fic_image = os.path.join(os.path.dirname(__file__),"icons",name)
index 83401a6cb339f6042cbeb15e4b408b20d9470de3..2b80e44df384672bbbe7ac925c8a26efcb625a20 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import CONNECTOR
-import adapt
+from . import CONNECTOR
+from . import adapt
 
 class Item:
   def __init__(self,label=""):
@@ -62,7 +62,7 @@ class Item:
 ADAPT=adapt.adapt
 items={}
 def adapt(obj):
-  if items.has_key(obj.ptr()):
+  if obj.ptr() in items:
     return items[obj.ptr()]
   else:
     item= ADAPT(obj,Item)
index 50eb722214669794c9daed59663bb704637e00b6..9dd6baa9fd469e8fd8842719f4359305df937b76 100644 (file)
 import sys
 import pilot
 import SALOMERuntime
-import Item
-import adapt
+from . import Item
+from . import adapt
 from qt import *
 from qtcanvas import *
-import Editor
-import CItems
+from . import Editor
+from . import CItems
 import pygraphviz
 import traceback
-import CONNECTOR
-import graph
-import panels
+from . import CONNECTOR
+from . import graph
+from . import panels
 
 class DataLinkItem(Item.Item):
   def __init__(self,pin,pout):
@@ -174,7 +174,7 @@ class ItemComposedNode(Item.Item):
     return tabWidget
 
   def addNode(self,service):
-    print "Composed.addNode",service
+    print("Composed.addNode",service)
     #add node service in the parent self which is a ComposedNode
     new_node=service.clone(None)
     ItemComposedNode.n=ItemComposedNode.n+1
@@ -196,7 +196,7 @@ class ItemComposedNode(Item.Item):
   panels=[("Panel1",panel1)]
 
   def addLink(self,link):
-    print "Composed.addLink",link
+    print("Composed.addLink",link)
     if isinstance(link,DataLinkItem):
       self.datalinks.addLink(link)
     elif isinstance(link,StreamLinkItem):
@@ -237,7 +237,7 @@ class ItemSwitch(ItemComposedNode):
 class ItemProc(ItemComposedNode):
   """Item pour la procedure"""
   def connecting(self,item):
-    print "ItemProc.connecting",item
+    print("ItemProc.connecting",item)
     self._connecting=item
 
 class ItemPort(Item.Item):
@@ -276,10 +276,10 @@ class ItemPort(Item.Item):
   box=panel
 
   def link(self,other):
-    print "ItemPort.link:",self,other
+    print("ItemPort.link:",self,other)
 
   def connect(self):
-    print "ItemPort.connect:"
+    print("ItemPort.connect:")
     self.root.connecting(self)
 
 class ItemInPort(ItemPort):
@@ -317,7 +317,7 @@ class ItemOutPort(ItemPort):
       if not cflink:
         #add also a control flow link
         fitem.addLink(ControlLinkItem(nodeS,nodeE))
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
@@ -340,7 +340,7 @@ class ItemOutStream(ItemPort):
       l=StreamLinkItem(other.port,self.port)
       fitem=Item.adapt(father)
       fitem.addLink(l)
-    except ValueError,ex:
+    except ValueError as ex:
       traceback.print_exc()
       QMessageBox.warning(None,"YACS error",str(ex))
       return
index ad36686e0039b548287231491d59ebf3460211e8..55d742ca48f3e29f0c4bc02c371b5fb73cf099ed 100644 (file)
@@ -18,7 +18,7 @@
 #
 
 from qt import *
-import CONNECTOR
+from . import CONNECTOR
 
 class PanelManager(QWidgetStack):
   """ A PanelManager manages a collection of widget
@@ -36,7 +36,7 @@ class PanelManager(QWidgetStack):
     CONNECTOR.Connect(self.rootItem,"dblselected",self.setview,())
 
   def setview(self,item):
-    if not self.panels.has_key(item):
+    if item not in self.panels:
       panel=item.panel(self)
       self.panels[item]=panel
       idd=self.addWidget(panel)
index 439a081dad04e17cb3b8a9484b7d3230c8a779af..ff0fc50f98207ea6b7ba578cfefdc3dd35dcbfd1 100644 (file)
@@ -26,8 +26,8 @@
 
 import sys
 from qt import *
-import Icons
-import CONNECTOR
+from . import Icons
+from . import CONNECTOR
 
 class Tree(QListView):
   """Tree(parent=None)
@@ -156,7 +156,7 @@ class Node(QListViewItem):
        
 
 if __name__ == "__main__":
-  from Item import Item
+  from .Item import Item
   app = QApplication(sys.argv)
   t=Tree()
   t.additem(Item("item1"))
index dded890b565c928267970a6d3b24d51bb2f9435a..352911c7226a5270d1e250eafa1ebc9a80c522b9 100644 (file)
@@ -37,7 +37,7 @@ def _adapt_by_registry(obj, protocol, alternate):
         else:
             adapter = factory(obj, protocol, alternate)
         if adapter is AdaptationError:
-            raise AdaptationError,obj
+            raise AdaptationError(obj)
         else:
             return adapter
 
index ea2f2d57e3cdbc6acad0890ad800c65ded3bf70f..48a6d219c9444cc2192dd6a7281f539334a22158 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import Tree
-from BoxManager import BoxManager
+from . import Tree
+from .BoxManager import BoxManager
 
 class Browser(QVBox):
   def __init__(self,parent,appli):
index a97504b7c49763526ae72169a46eaae03835eab5..c6b645bfa444e0ea7829c419cd5a2f9ddea8074d 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser
-import cataitems
+from . import browser
+from . import cataitems
 
 class Browser(browser.Browser):
   def init(self):
@@ -30,7 +30,7 @@ class Browser(browser.Browser):
     self.connect( but1, SIGNAL("clicked()"), self.handleBut1 )
 
   def handleBut1(self):
-    print "handleBut1",self.selected
+    print("handleBut1",self.selected)
     if hasattr(self.selected,"addNode"):
       self.selected.addNode(self.appli)
     return
index ed5cc95525d0fb6fb4dca7694605184418862cf6..3e97c45f34d551ab02126156171aacb02daf5bc8 100644 (file)
@@ -19,8 +19,8 @@
 
 import sys
 from qt import *
-import browser
-import sessions
+from . import browser
+from . import sessions
 import pilot
 
 class Browser(browser.Browser):
index 574f1faa880e63fa71dfcd1cd9d32415d6f7cf0e..111273387277ff575358fe74d2535bffaff2b308 100644 (file)
@@ -19,9 +19,9 @@
 
 from qt import *
 
-import Item
-import CONNECTOR
-import Items
+from . import Item
+from . import CONNECTOR
+from . import Items
 
 class Obj(Item.Item):
   def __init__(self,root=None):
@@ -124,7 +124,7 @@ class ItemCompo(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for service in self.compo._serviceMap.values():
+    for service in list(self.compo._serviceMap.values()):
       itemservice=ItemService(service,self.root)
       sublist.append(itemservice)
     return sublist
@@ -197,7 +197,7 @@ class TypesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for name,typ in self.typeMap.items():
+    for name,typ in list(self.typeMap.items()):
       itemtype=ItemType(typ,self.root,name)
       sublist.append(itemtype)
     return sublist
@@ -218,7 +218,7 @@ class ComponentsItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for compo in self.compoMap.values():
+    for compo in list(self.compoMap.values()):
       itemcompo=ItemCompo(compo,self.root)
       sublist.append(itemcompo)
     return sublist
@@ -239,7 +239,7 @@ class NodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.nodesMap.values():
+    for node in list(self.nodesMap.values()):
       itemnode=ItemNode(node,self.root)
       sublist.append(itemnode)
     return sublist
@@ -260,7 +260,7 @@ class ComposedNodesItem(Item.Item):
 
   def getChildren(self):
     sublist=[]
-    for node in self.composedMap.values():
+    for node in list(self.composedMap.values()):
       itemnode=ItemComposedNode(node,self.root)
       sublist.append(itemnode)
     return sublist
index 43cdd73c59fe890977812599b2f9b56e436c4db3..fe86e2c7d88aa884436f1b7fb7be3907bed271e6 100644 (file)
@@ -18,8 +18,8 @@
 #
 
 from qt import *
-import browser_session
-import browser_catalog
+from . import browser_session
+from . import browser_catalog
 import pilot
 
 class CatalogTool(QMainWindow):
@@ -74,10 +74,10 @@ class CatalogTool(QMainWindow):
       return
     filename = str(fn)
     cata=pilot.getRuntime().loadCatalog("proc",filename)
-    print cata
-    print cata._nodeMap
-    for name,node in cata._nodeMap.items():
-      print name,node
+    print(cata)
+    print(cata._nodeMap)
+    for name,node in list(cata._nodeMap.items()):
+      print(name,node)
     self.register(cata,filename)
 
   def register(self,cata,name):
index db2a0c4f26e39ef15f68e6276e3a03d5eb9ba175..73057b7cc077d04196ae50dc7406f1f132c9365e 100644 (file)
 
 import sys
 import pilot
-import Item
+from . import Item
 from qt import *
 from qtcanvas import *
-from GraphViewer import GraphViewer
-import Editor
-import CItems
+from .GraphViewer import GraphViewer
+from . import Editor
+from . import CItems
 import pygraphviz
 from pygraphviz import graphviz as gv
 import traceback
-import CONNECTOR
+from . import CONNECTOR
 import bisect
 
 class MyCanvas(QCanvas):
@@ -68,7 +68,7 @@ class Graph:
       citems[n.ptr()]=c
       c.show()
 
-    for k,n in citems.items():
+    for k,n in list(citems.items()):
       for p in n.inports:
         pitems[p.port.ptr()]=p
       for p in n.outports:
@@ -91,7 +91,7 @@ class Graph:
     self.layout("LR")
 
   def addLink(self,link):
-    print "graph.addLink",link
+    print("graph.addLink",link)
     #CItem for outport
     nodeS=self.citems[link.pout.getNode().ptr()]
     nodeE=self.citems[link.pin.getNode().ptr()]
@@ -127,7 +127,7 @@ class Graph:
     G.graph_attr["dpi"]="72"
     dpi=72.
     aspect=dpi/72
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       #k is node address (YACS)
       #n is item in canvas
       G.add_node(k)
@@ -139,7 +139,7 @@ class Graph:
         continue
       G.add_edge(pout.getNode().ptr(),pin.getNode().ptr())
 
-    for k,n in self.citems.items():
+    for k,n in list(self.citems.items()):
       for ndown in n.node.getOutNodes():
         G.add_edge(n.node.ptr(),ndown.ptr())
 
@@ -183,7 +183,7 @@ class Graph:
     self.canvas.update()
 
   def clearLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     for node in items:
       for port in node.outports:
         if not hasattr(port,"links"):
@@ -193,7 +193,7 @@ class Graph:
     self.canvas.update()
 
   def orthoLinks(self):
-    items=self.citems.values()
+    items=list(self.citems.values())
     g=grid(items)
     for node in items:
       for port in node.outports:
@@ -328,10 +328,10 @@ class grid:
     self.xs=xs
     self.ys=ys
     self.cols=[]
-    for w in xrange(len(xs)-1):
+    for w in range(len(xs)-1):
       col=[]
       x=(xs[w]+xs[w+1])/2
-      for h in xrange(len(ys)-1):
+      for h in range(len(ys)-1):
         y=(ys[h]+ys[h+1])/2
         col.append(node((x,y),(w,h)))
       self.cols.append(col)
@@ -412,7 +412,7 @@ class grid:
     self.open.append((fromNode.total,fromNode))
     toNode=self.get(toLoc)
     if toNode.blocked:
-      print "toNode is blocked"
+      print("toNode is blocked")
       return []
     destx,desty=toNode.coord
     while self.open:
index a26f095cc909983c3ddd1d95f1a4dc372d0490f2..c15fc9306bf5173938ca0d068992a87e4637b8ac 100644 (file)
@@ -19,8 +19,8 @@
 
 from qt import *
 import traceback
-import Editor
-import Item
+from . import Editor
+from . import Item
 
 class PanelScript(QVBox):
   def __init__(self,parent,item):
index 46c0ded2fde70fda23995897f9c7f5053c94eeb1..021488da60bb93aff79e1852efa975b0d7cf1c3f 100644 (file)
@@ -22,8 +22,8 @@ import omniORB
 from omniORB import CORBA
 import CosNaming
 
-import Item
-import CONNECTOR
+from . import Item
+from . import CONNECTOR
 
 class Sessions(Item.Item):
   def __init__(self,port):
index 8ea3c79796d6a0dd67b25ece55ce8f7ab4386f41..366e5b7ef2afe97911181683fc4c08c11aed5bfd 100644 (file)
@@ -389,7 +389,7 @@ class _ElementInterface:
     # @defreturn list of strings
 
     def keys(self):
-        return self.attrib.keys()
+        return list(self.attrib.keys())
 
     ##
     # Gets element attributes, as a sequence.  The attributes are
@@ -399,7 +399,7 @@ class _ElementInterface:
     # @defreturn list of (string, string) tuples
 
     def items(self):
-        return self.attrib.items()
+        return list(self.attrib.items())
 
     ##
     # Creates a tree iterator.  The iterator loops over this element
@@ -667,7 +667,7 @@ class ElementTree:
         elif tag is ProcessingInstruction:
             file.write("<?%s?>" % _escape_cdata(node.text, encoding))
         else:
-            items = node.items()
+            items = list(node.items())
             xmlns_items = [] # new namespaces in this scope
             try:
                 if isinstance(tag, QName) or tag[:1] == "{":
@@ -915,7 +915,7 @@ class iterparse:
                     append((event, None))
                 parser.EndNamespaceDeclHandler = handler
 
-    def next(self):
+    def __next__(self):
         while 1:
             try:
                 item = self._events[self._index]
@@ -945,7 +945,7 @@ class iterparse:
             return self
     except NameError:
         def __getitem__(self, index):
-            return self.next()
+            return next(self)
 
 ##
 # Parses an XML document from a string constant.  This function can
@@ -1165,7 +1165,7 @@ class XMLTreeBuilder:
         fixname = self._fixname
         tag = fixname(tag)
         attrib = {}
-        for key, value in attrib_in.items():
+        for key, value in list(attrib_in.items()):
             attrib[fixname(key)] = self._fixtext(value)
         return self._target.start(tag, attrib)
 
index 29b2d2b2c2ab1a521c4e5137b1aad2a51a78f157..9586575c8d6eafebf90a26c41b3f6c3082236ea8 100644 (file)
@@ -95,9 +95,9 @@ def test():
   }
   display(G)
   I=invert(G)
-  print reachable(G,2)
-  print reachable(I,6)
-  print reachable(G,2) & reachable(I,6)
+  print(reachable(G,2))
+  print(reachable(I,6))
+  print(reachable(G,2) & reachable(I,6))
 
 if __name__ == "__main__":
   test()
index 09431ab255a58ec45102ff53bf099dbf27f5c55b..68be1a656a7057ee0598a73c364606e2ed9797da 100644 (file)
@@ -69,22 +69,22 @@ class SalomeLoader:
     """
     tree = ElementTree.ElementTree(file=filename)
     root = tree.getroot()
-    if debug:print "root.tag:",root.tag,root
+    if debug:print("root.tag:",root.tag,root)
 
     procs=[]
     if root.tag == "dataflow":
       #only one dataflow
       dataflow=root
-      if debug:print dataflow
+      if debug:print(dataflow)
       proc=SalomeProc(dataflow)
       procs.append(proc)
     else:
       #one or more dataflows. The graph contains macros.
       #All macros are defined at the same level in the XML file.
       for dataflow in root.findall("dataflow"):
-        if debug:print dataflow
+        if debug:print(dataflow)
         proc=SalomeProc(dataflow)
-        if debug:print "dataflow name:",proc.name
+        if debug:print("dataflow name:",proc.name)
         procs.append(proc)
     return procs
 
@@ -105,10 +105,10 @@ class SalomeLoader:
     #Put macros in macro_dict
     macro_dict={}
     for p in procs:
-      if debug:print "proc_name:",p.name,"coupled_node:",p.coupled_node
+      if debug:print("proc_name:",p.name,"coupled_node:",p.coupled_node)
       macro_dict[p.name]=p
 
-    if debug:print filename
+    if debug:print(filename)
     yacsproc=ProcNode(proc,macro_dict,filename)
     return yacsproc.createNode()
 
@@ -223,17 +223,17 @@ class InlineNode(Node):
         n.setScript(self.codes[0])
       self.node=n
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddOutputPort(para.name,typeMap[para.type])
 
@@ -249,7 +249,7 @@ class ComputeNode(Node):
         return self.node
 
       r = pilot.getRuntime()
-      if self.container.components.has_key(self.sComponent):
+      if self.sComponent in self.container.components:
         #a node for this component already exists
         compo_node=self.container.components[self.sComponent]
         #It's a node associated with another node of the same component instance
@@ -271,27 +271,27 @@ class ComputeNode(Node):
 
       #add  dataflow ports in out 
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         n.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #Create the missing type and adds it into types table
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         pout=n.edAddOutputPort(para.name,typeMap[para.type])
 
       #add datastream ports in and out
       for para in self.inStreams:
-        if debug:print para.name,para.type,para.dependency,para.schema, para.interpolation,
-        if debug:print para.extrapolation
+        if debug:print(para.name,para.type,para.dependency,para.schema, para.interpolation, end=' ')
+        if debug:print(para.extrapolation)
         pin=n.edAddInputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
       for para in self.outStreams:
-        if debug:print para.name,para.type,para.dependency,para.values
+        if debug:print(para.name,para.type,para.dependency,para.values)
         pout=n.edAddOutputDataStreamPort(para.name,typeMap[streamTypes[para.type]])
 
       for d in self.datas:
@@ -323,11 +323,11 @@ class ComposedNode(Node):
         n.inner_nodes=loops[n]
         n.G=graph.InducedSubgraph(loops[n],G)
 
-    if debug:print "all loops"
-    if debug:print loops
+    if debug:print("all loops")
+    if debug:print(loops)
 
     #Get most external loops 
-    outer_loops=loops.keys()
+    outer_loops=list(loops.keys())
     for l in loops:
       for ll in outer_loops:
         if loops[l] < loops[ll]:
@@ -337,7 +337,7 @@ class ComposedNode(Node):
           break
 
     #In the end all remaining loops in outer_loops are the most external
-    if debug:print outer_loops
+    if debug:print(outer_loops)
 
     #We remove all internal nodes of most external loops 
     for l in outer_loops:
@@ -354,14 +354,14 @@ class ComposedNode(Node):
       #outcoming links of internal nodes. Probably not complete.
       inputs={}
       for link in l.endloop.links:
-        if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+        if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
         inputs[link.to_param]=link.from_node,link.from_param
 
       for s in suiv:
         for link in s.links:
           if link.from_node == l.endloop:
             link.from_node,link.from_param=inputs[link.from_param]
-          if debug:print link.from_node,link.to_node,link.from_param,link.to_param
+          if debug:print(link.from_node,link.to_node,link.from_param,link.to_param)
 
       if debug:graph.display(G)
 
@@ -373,7 +373,7 @@ class ComposedNode(Node):
     """This method connects the salome macros in macro_dict to the master YACS Proc.
        
     """
-    if debug:print "connect_macros",self.node,macro_dict
+    if debug:print("connect_macros",self.node,macro_dict)
     for node in self.G:
       if isinstance(node,MacroNode):
         #node is a macro, connect its definition to self.
@@ -382,7 +382,7 @@ class ComposedNode(Node):
         #node.node is the YACS Bloc equivalent to node
         p=macro_dict[node.coupled_node]
         bloc=node.node
-        if debug:print "macronode:",node.name,node.coupled_node,p
+        if debug:print("macronode:",node.name,node.coupled_node,p)
         #Create a hierarchical graph from the salome graph
         G=p.create_graph()
         node.G=G
@@ -486,17 +486,17 @@ class LoopNode(ComposedNode):
       init.setScript(self.codes[0])
       init.setFname(self.fnames[0])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         init.edAddOutputPort(para.name,typeMap[para.type])
       bloop.edAddChild(init)
@@ -515,17 +515,17 @@ class LoopNode(ComposedNode):
       next.setScript(self.codes[2])
       next.setFname(self.fnames[2])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddInputPort(para.name,typeMap[para.type])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         next.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(next)
@@ -537,18 +537,18 @@ class LoopNode(ComposedNode):
       more.setScript(self.codes[1])
       more.setFname(self.fnames[1])
       for para in self.service.inParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddInputPort(para.name,typeMap[para.type])
       more.edAddOutputPort("DoLoop",typeMap["int"])
       for para in self.service.outParameters:
-        if not typeMap.has_key(para.type):
+        if para.type not in typeMap:
           #create the missing type and add it in type map
           typeMap[para.type]= currentProc.createInterfaceTc("",para.type,[objref])
-        if not currentProc.typeMap.has_key(para.type):
+        if para.type not in currentProc.typeMap:
           currentProc.typeMap[para.type]=typeMap[para.type]
         more.edAddOutputPort(para.name,typeMap[para.type])
       blnode.edAddChild(more)
@@ -678,7 +678,7 @@ class ProcNode(ComposedNode):
     currentProc.typeMap["CALCIUM_real"]=typeMap["CALCIUM_real"]
 
     #create all containers
-    for name,container in _containers.items():
+    for name,container in list(_containers.items()):
       cont=r.createContainer()
       cont.setName(name)
       cont.setProperty("hostname",container.mach)
@@ -767,23 +767,23 @@ class SalomeProc(ComposedNode):
         #each node has 2 lists of datastream links (inStreams, outStreams)
 
     def parse(self,dataflow):
-        if debug:print "All XML nodes"
+        if debug:print("All XML nodes")
         for node in dataflow:
-            if debug:print node.tag,node
+            if debug:print(node.tag,node)
 
         #Parse dataflow info-list
         self.dataflow_info=self.parseService(dataflow.find("info-list/node/service"))
-        if debug:print self.dataflow_info
-        if debug:print self.dataflow_info.inParameters
-        if debug:print self.dataflow_info.outParameters
+        if debug:print(self.dataflow_info)
+        if debug:print(self.dataflow_info.inParameters)
+        if debug:print(self.dataflow_info.outParameters)
         if debug:
             for para in self.dataflow_info.inParameters:
-                print "inParam:",para.name,para.name.split("__",1)
+                print("inParam:",para.name,para.name.split("__",1))
 
         self.name=dataflow.findtext("info-list/node/node-name")
         self.coupled_node=dataflow.findtext("info-list/node/coupled-node")
 
-        if debug:print "All XML nodes dataflow/node-list"
+        if debug:print("All XML nodes dataflow/node-list")
         nodes=[]
         node_dict={}
         #Parse all nodes
@@ -811,7 +811,7 @@ class SalomeProc(ComposedNode):
               node.container= getContainer(container)
               if not node.container:
                 node.container=addContainer(container)
-              if debug:print "\tcontainer",node.container
+              if debug:print("\tcontainer",node.container)
 
             elif kind == "3":
               #It's a python function
@@ -855,15 +855,15 @@ class SalomeProc(ComposedNode):
               node=MacroNode()
               node.kind=10
             else:
-              raise UnknownKind,kind
+              raise UnknownKind(kind)
 
             node.name=name
             node.service=None
             node.coupled_node=coupled_node
             #Put nodes in a dict to ease search
             node_dict[node.name]=node
-            if debug:print "\tnode-name",node.name
-            if debug:print "\tkind",node.kind,node.__class__.__name__
+            if debug:print("\tnode-name",node.name)
+            if debug:print("\tkind",node.kind,node.__class__.__name__)
 
             s=n.find("service")
             if s:
@@ -871,7 +871,7 @@ class SalomeProc(ComposedNode):
 
 
             #Parse datastream ports
-            if debug:print "DataStream ports"
+            if debug:print("DataStream ports")
             inStreams=[]
             for indata in n.findall("DataStream-list/inParameter"):
                 inStreams.append(self.parseInData(indata))
@@ -884,7 +884,7 @@ class SalomeProc(ComposedNode):
                 outStreams_dict[p.name]=p
             node.outStreams=outStreams
             node.outStreams_dict=outStreams_dict
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
             nodes.append(node)
 
         self.nodes=nodes
@@ -900,9 +900,9 @@ class SalomeProc(ComposedNode):
         <coord-list/>
         </link>
         """
-        if debug:print "All XML nodes dataflow/link-list"
+        if debug:print("All XML nodes dataflow/link-list")
         links=[]
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         for link in dataflow.findall('link-list/link'):
             l=Link()
             l.from_name=link.findtext("fromnode-name")
@@ -910,52 +910,52 @@ class SalomeProc(ComposedNode):
             l.from_param=link.findtext("fromserviceparameter-name")
             l.to_param=link.findtext("toserviceparameter-name")
             links.append(l)
-            if debug:print "\tfromnode-name",l.from_name
-            if debug:print "\tfromserviceparameter-name",l.from_param
-            if debug:print "\ttonode-name",l.to_name
-            if debug:print "\ttoserviceparameter-name",l.to_param
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\tfromnode-name",l.from_name)
+            if debug:print("\tfromserviceparameter-name",l.from_param)
+            if debug:print("\ttonode-name",l.to_name)
+            if debug:print("\ttoserviceparameter-name",l.to_param)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.links=links
-        if debug:print "All XML nodes dataflow/data-list"
+        if debug:print("All XML nodes dataflow/data-list")
         datas=[]
         for data in dataflow.findall('data-list/data'):
             d=self.parseData(data)
             datas.append(d)
-            if debug:print "\ttonode-name",d.tonode
-            if debug:print "\ttoserviceparameter-name",d.tonodeparam
-            if debug:print "\tparameter-value",d.value
-            if debug:print "\tparameter-type",d.type
-            if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+            if debug:print("\ttonode-name",d.tonode)
+            if debug:print("\ttoserviceparameter-name",d.tonodeparam)
+            if debug:print("\tparameter-value",d.value)
+            if debug:print("\tparameter-type",d.type)
+            if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         self.datas=datas
 
     def parseService(self,s):
         service=Service()
         service.name=s.findtext("service-name")
-        if debug:print "\tservice-name",service.name
+        if debug:print("\tservice-name",service.name)
 
         inParameters=[]
         for inParam in s.findall("inParameter-list/inParameter"):
             p=Parameter()
             p.name=inParam.findtext("inParameter-name")
             p.type=typeName(inParam.findtext("inParameter-type"))
-            if debug:print "\tinParameter-name",p.name
-            if debug:print "\tinParameter-type",p.type
+            if debug:print("\tinParameter-name",p.name)
+            if debug:print("\tinParameter-type",p.type)
             inParameters.append(p)
         service.inParameters=inParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
 
         outParameters=[]
         for outParam in s.findall("outParameter-list/outParameter"):
             p=Parameter()
             p.name=outParam.findtext("outParameter-name")
             p.type=typeName(outParam.findtext("outParameter-type"))
-            if debug:print "\toutParameter-name",p.name
-            if debug:print "\toutParameter-type",p.type
+            if debug:print("\toutParameter-name",p.name)
+            if debug:print("\toutParameter-type",p.type)
             outParameters.append(p)
         service.outParameters=outParameters
-        if debug:print "\t++++++++++++++++++++++++++++++++++++++++++++"
+        if debug:print("\t++++++++++++++++++++++++++++++++++++++++++++")
         return service
 
     def parseData(self,d):
@@ -969,8 +969,8 @@ class SalomeProc(ComposedNode):
         return da
 
     def parsePyFunction(self,pyfunc):
-        if debug:print pyfunc.tag,":",pyfunc
-        if debug:print "\tFuncName",pyfunc.findtext("FuncName")
+        if debug:print(pyfunc.tag,":",pyfunc)
+        if debug:print("\tFuncName",pyfunc.findtext("FuncName"))
         text=""
         for cdata in pyfunc.findall("PyFunc"):
             if text:text=text+'\n'
@@ -994,7 +994,7 @@ class SalomeProc(ComposedNode):
     """
 
     def parseInData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("inParameter-name")
         p.type=typeName(d.findtext("inParameter-type"))
@@ -1002,17 +1002,17 @@ class SalomeProc(ComposedNode):
         p.schema=d.findtext("inParameter-schema")
         p.interpolation=d.findtext("inParameter-interpolation")
         p.extrapolation=d.findtext("inParameter-extrapolation")
-        if debug:print "\tinParameter-name",p.name
+        if debug:print("\tinParameter-name",p.name)
         return p
 
     def parseOutData(self,d):
-        if debug:print d.tag,":",d
+        if debug:print(d.tag,":",d)
         p=Parameter()
         p.name=d.findtext("outParameter-name")
         p.type=typeName(d.findtext("outParameter-type"))
         p.dependency=d.findtext("outParameter-dependency")
         p.values=d.findtext("outParameter-values")
-        if debug:print "\toutParameter-name",p.name
+        if debug:print("\toutParameter-name",p.name)
         return p
 
     def create_graph(self):
@@ -1030,14 +1030,14 @@ class SalomeProc(ComposedNode):
         from_node=self.node_dict[link.from_name]
         if link.from_param == "Gate" or link.to_param == "Gate":
           #control link salome : add to_name node to neighbours
-          if debug:print "add control link",link.from_name,link.to_name
+          if debug:print("add control link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
-        elif from_node.outStreams_dict.has_key(link.from_param):
+        elif link.from_param in from_node.outStreams_dict:
           # datastream link : 
           # 1- add link in link list
           # 2- add in link references on from_node and to_node
-          if debug:print "add stream link",link.from_name,link.to_name
+          if debug:print("add stream link",link.from_name,link.to_name)
           self.node_dict[link.to_name].inStreamLinks.append(link)
           self.node_dict[link.from_name].outStreamLinks.append(link)
           link.from_node=self.node_dict[link.from_name]
@@ -1052,10 +1052,10 @@ class SalomeProc(ComposedNode):
           if isinstance(to_node,LoopNode):
             # If it's the link from EndOfLoop to Loop , we ignore it
             if to_node.coupled_node == from_node.name:
-              if debug:print "backlink loop:",from_node,to_node
+              if debug:print("backlink loop:",from_node,to_node)
               #ignored
               continue
-          if debug:print "add dataflow link",link.from_name,link.to_name
+          if debug:print("add dataflow link",link.from_name,link.to_name)
           G[self.node_dict[link.from_name]].add(self.node_dict[link.to_name])
 
           if link.from_param != "DoLoop" and link.to_param != "DoLoop":
@@ -1074,12 +1074,12 @@ class SalomeProc(ComposedNode):
              and isinstance(self.node_dict[link.to_name],InlineNode):
             #Store the end loop inline node in attribute endloop
             #self.node_dict[link.to_name] is the end node of the head loop node self.node_dict[link.from_name]
-            if debug:print "add loop",link.from_name,link.to_name
+            if debug:print("add loop",link.from_name,link.to_name)
             self.node_dict[link.from_name].endloop=self.node_dict[link.to_name]
             self.node_dict[link.to_name].loop=self.node_dict[link.from_name]
 
       for data in self.datas:
-        if debug:print "datas",data
+        if debug:print("datas",data)
         self.node_dict[data.tonode].datas.append(data)
 
       self.G=G
@@ -1126,7 +1126,7 @@ def main():
     salomeFile=sys.argv[1]
     convertedFile=sys.argv[2]
   except :
-    print usage%(sys.argv[0])
+    print(usage%(sys.argv[0]))
     sys.exit(3)
 
   SALOMERuntime.RuntimeSALOME_setRuntime()
@@ -1144,7 +1144,7 @@ def main():
 
   logger=p.getLogger("parser")
   if not logger.isEmpty():
-    print logger.getStr()
+    print(logger.getStr())
     sys.exit(1)
 
 if __name__ == "__main__":
index a9496dd7070e9ea3df225940f7e3dc6dc1ef37e3..2714c438da8fc6f021509083167cf681182d3bff 100644 (file)
@@ -29,7 +29,7 @@ else:
 pass
 #
 #
-print "Test Program of Cpp_Template_ component"
+print("Test Program of Cpp_Template_ component")
 
 # ...
 
index 4fcfc55bda86a357e500dbcf76f9248c11060ab0..cb1d7b05e99b7fea35b0cdf472f8c2c3b9c4d709 100755 (executable)
@@ -40,14 +40,14 @@ usage="""USAGE: runSalome.py [options]
 #
 
 def killSalome():
-    print "arret des serveurs SALOME"
-    for pid, cmd in process_id.items():
-        print "arret du process %s : %s"% (pid, cmd[0])
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
         try:
             os.kill(pid,signal.SIGKILL)
         except:
-            print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-    print "arret du naming service"
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
     os.system("killall -9 omniNames")
 
 # -----------------------------------------------------------------------------
@@ -56,7 +56,7 @@ def killSalome():
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -78,7 +78,7 @@ with_container_superv=0
 try:
     for o, a in opts:
         if o in ('-h', '--help'):
-            print usage
+            print(usage)
             sys.exit(1)
         elif o in ('-g', '--gui'):
             with_gui=1
@@ -113,7 +113,7 @@ try:
                 fpid=open(filedict, 'r')
                 found = 1
             except:
-                print "le fichier %s des process SALOME n'est pas accessible"% filedict
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
 
             if found:
                 process_id=pickle.load(fpid)
@@ -122,8 +122,8 @@ try:
                 process_id={}
                 os.remove(filedict)
 
-except getopt.error, msg:
-    print usage
+except getopt.error as msg:
+    print(usage)
     sys.exit(1)
 
 # -----------------------------------------------------------------------------
@@ -134,7 +134,7 @@ try:
     kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
     modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-    print usage
+    print(usage)
     sys.exit(1)
 
 for module in liste_modules :
@@ -143,7 +143,7 @@ for module in liste_modules :
         module_root_dir=os.environ[module +"_ROOT_DIR"]
         modules_root_dir[module]=module_root_dir
     except:
-        print usage
+        print(usage)
         sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
@@ -156,7 +156,7 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
@@ -187,7 +187,7 @@ class CatalogServer(Server):
         for module in liste_modules:
             module_root_dir=modules_root_dir[module]
             module_cata=module+"Catalog.xml"
-            print "   ", module_cata
+            print("   ", module_cata)
             cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
         self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
@@ -367,7 +367,7 @@ def startSalome():
     SalomeDSServer().run()
 
     if "GEOM" in liste_modules:
-        print "GEOM OCAF Resources"
+        print("GEOM OCAF Resources")
         os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
 
 
@@ -430,8 +430,8 @@ def startSalome():
     #session.GetInterface()
 
     end_time = os.times()
-    print
-    print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
     return clt
 
@@ -444,9 +444,9 @@ if __name__ == "__main__":
     try:
         clt = startSalome()
     except:
-        print
-        print
-        print "--- erreur au lancement Salome ---"
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
 
     #print process_id
 
@@ -458,7 +458,7 @@ if __name__ == "__main__":
     pickle.dump(process_id,fpid)
     fpid.close()
 
-    print """
+    print("""
 
  Sauvegarde du dictionnaire des process dans , %s
  Pour tuer les process SALOME, executer : python killSalome.py depuis
@@ -471,15 +471,15 @@ if __name__ == "__main__":
  Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
  s'il n'est pas fermé.
 
- """ % filedict
+ """ % filedict)
 
     #
     #  Impression arborescence Naming Service
     #
 
     if clt != None:
-        print
-        print " --- registered objects tree in Naming Service ---"
+        print()
+        print(" --- registered objects tree in Naming Service ---")
         clt.showNS()
         session=clt.waitNS("/Kernel/Session")
         catalog=clt.waitNS("/Kernel/ModulCatalog")
@@ -520,4 +520,4 @@ if __name__ == "__main__":
         f.write(PYTHONSTARTUP)
         f.close()
 
-    exec PYTHONSTARTUP in {}
+    exec(PYTHONSTARTUP, {})
index 4fcfc55bda86a357e500dbcf76f9248c11060ab0..cb1d7b05e99b7fea35b0cdf472f8c2c3b9c4d709 100755 (executable)
@@ -40,14 +40,14 @@ usage="""USAGE: runSalome.py [options]
 #
 
 def killSalome():
-    print "arret des serveurs SALOME"
-    for pid, cmd in process_id.items():
-        print "arret du process %s : %s"% (pid, cmd[0])
+    print("arret des serveurs SALOME")
+    for pid, cmd in list(process_id.items()):
+        print("arret du process %s : %s"% (pid, cmd[0]))
         try:
             os.kill(pid,signal.SIGKILL)
         except:
-            print "  ------------------ process %s : %s inexistant"% (pid, cmd[0])
-    print "arret du naming service"
+            print("  ------------------ process %s : %s inexistant"% (pid, cmd[0]))
+    print("arret du naming service")
     os.system("killall -9 omniNames")
 
 # -----------------------------------------------------------------------------
@@ -56,7 +56,7 @@ def killSalome():
 #
 
 def message(code, msg=''):
-    if msg: print msg
+    if msg: print(msg)
     sys.exit(code)
 
 import sys,os,string,glob,time,signal,pickle,getopt
@@ -78,7 +78,7 @@ with_container_superv=0
 try:
     for o, a in opts:
         if o in ('-h', '--help'):
-            print usage
+            print(usage)
             sys.exit(1)
         elif o in ('-g', '--gui'):
             with_gui=1
@@ -113,7 +113,7 @@ try:
                 fpid=open(filedict, 'r')
                 found = 1
             except:
-                print "le fichier %s des process SALOME n'est pas accessible"% filedict
+                print("le fichier %s des process SALOME n'est pas accessible"% filedict)
 
             if found:
                 process_id=pickle.load(fpid)
@@ -122,8 +122,8 @@ try:
                 process_id={}
                 os.remove(filedict)
 
-except getopt.error, msg:
-    print usage
+except getopt.error as msg:
+    print(usage)
     sys.exit(1)
 
 # -----------------------------------------------------------------------------
@@ -134,7 +134,7 @@ try:
     kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
     modules_root_dir["KERNEL"]=kernel_root_dir
 except:
-    print usage
+    print(usage)
     sys.exit(1)
 
 for module in liste_modules :
@@ -143,7 +143,7 @@ for module in liste_modules :
         module_root_dir=os.environ[module +"_ROOT_DIR"]
         modules_root_dir[module]=module_root_dir
     except:
-        print usage
+        print(usage)
         sys.exit(1)
 
 # il faut KERNEL en premier dans la liste des modules
@@ -156,7 +156,7 @@ liste_modules[:0]=["KERNEL"]
 #print liste_modules
 #print modules_root_dir
 
-os.environ["SALOMEPATH"]=":".join(modules_root_dir.values())
+os.environ["SALOMEPATH"]=":".join(list(modules_root_dir.values()))
 if "SUPERV" in liste_modules:with_container_superv=1
 
 
@@ -187,7 +187,7 @@ class CatalogServer(Server):
         for module in liste_modules:
             module_root_dir=modules_root_dir[module]
             module_cata=module+"Catalog.xml"
-            print "   ", module_cata
+            print("   ", module_cata)
             cata_path.extend(glob.glob(os.path.join(module_root_dir,"share","salome","resources",module_cata)))
         self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
 
@@ -367,7 +367,7 @@ def startSalome():
     SalomeDSServer().run()
 
     if "GEOM" in liste_modules:
-        print "GEOM OCAF Resources"
+        print("GEOM OCAF Resources")
         os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")
 
 
@@ -430,8 +430,8 @@ def startSalome():
     #session.GetInterface()
 
     end_time = os.times()
-    print
-    print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])
+    print()
+    print("Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4]))
 
     return clt
 
@@ -444,9 +444,9 @@ if __name__ == "__main__":
     try:
         clt = startSalome()
     except:
-        print
-        print
-        print "--- erreur au lancement Salome ---"
+        print()
+        print()
+        print("--- erreur au lancement Salome ---")
 
     #print process_id
 
@@ -458,7 +458,7 @@ if __name__ == "__main__":
     pickle.dump(process_id,fpid)
     fpid.close()
 
-    print """
+    print("""
 
  Sauvegarde du dictionnaire des process dans , %s
  Pour tuer les process SALOME, executer : python killSalome.py depuis
@@ -471,15 +471,15 @@ if __name__ == "__main__":
  Pour lancer uniquement le GUI, executer startGUI() depuis le present interpreteur,
  s'il n'est pas fermé.
 
- """ % filedict
+ """ % filedict)
 
     #
     #  Impression arborescence Naming Service
     #
 
     if clt != None:
-        print
-        print " --- registered objects tree in Naming Service ---"
+        print()
+        print(" --- registered objects tree in Naming Service ---")
         clt.showNS()
         session=clt.waitNS("/Kernel/Session")
         catalog=clt.waitNS("/Kernel/ModulCatalog")
@@ -520,4 +520,4 @@ if __name__ == "__main__":
         f.write(PYTHONSTARTUP)
         f.close()
 
-    exec PYTHONSTARTUP in {}
+    exec(PYTHONSTARTUP, {})
index ce286e163e18e3b393fc32508b2a545388fd7cb5..993fbc0465aa788b7ae349da767a7e9196c8e897 100644 (file)
@@ -52,7 +52,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def startToTakeDecision(self):
     """This method is called only once to launch the algorithm. It must
@@ -66,7 +66,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
        pool, do nothing (wait for more samples), or empty the pool and
        return to finish the evaluation.
     """
-    print "startToTakeDecision"
+    print("startToTakeDecision")
     # fill the pool with samples
     iter=0
     self.pool.pushInSample(0, 0.5)
@@ -77,7 +77,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
       currentId=self.pool.getCurrentId()
       valIn = self.pool.getCurrentInSample().getDoubleValue()
       valOut = self.pool.getCurrentOutSample().getIntValue()
-      print "Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+      print("Compute currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
       iter=iter+1
       
       if iter < 3:
@@ -89,7 +89,7 @@ class myalgoasync(SALOMERuntime.OptimizerAlgASync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 8c03ab25aa8825fcae59e2609e54fe4a589efa3f..d5bed597d2328d07c07fc152083b7cf332f7bb95 100644 (file)
@@ -52,11 +52,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 0.5)
@@ -69,7 +69,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getDoubleValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -80,7 +80,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index 3cb08f02fc67e63588415dde2a343e0aa865addc..c129dbf5e5c0cdce44d6b75a2ce834f498904b28 100644 (file)
@@ -34,7 +34,7 @@ obj         = orb.resolve_initial_references("NameService")
 rootContext = obj._narrow(CosNaming.NamingContext)
 
 if rootContext is None:
-    print "Failed to narrow the root naming context"
+    print("Failed to narrow the root naming context")
     sys.exit(1)
 
 # Resolve the name "test.my_context/Echo.Object"
@@ -44,22 +44,22 @@ name = [CosNaming.NameComponent("test", "my_context"),
 try:
     obj = rootContext.resolve(name)
 
-except CosNaming.NamingContext.NotFound, ex:
-    print "Name not found"
+except CosNaming.NamingContext.NotFound as ex:
+    print("Name not found")
     sys.exit(1)
 
 # Narrow the object to an eo::Echo
 echo = obj._narrow(eo.Echo)
 
 if echo is None:
-    print "Object reference is not an eo::Echo"
+    print("Object reference is not an eo::Echo")
     sys.exit(1)
 
 # Invoke the echoString operation
 message = "Hello from Python"
 result  = echo.echoString(message)
 
-print "I said '%s'. The object said '%s'." % (message,result)
+print("I said '%s'. The object said '%s'." % (message,result))
 
 """
   struct S1
@@ -80,32 +80,32 @@ s1=eo.S1(x=1,y=2,s="aa",b=True,vd=[1,2])
 s2=eo.S2(s1)
 
 r=echo.echoStruct(s2)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=None)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 ob=echo.createObj(3)
-print ob
+print(ob)
 oc=echo.createC()
-print oc
+print(oc)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=ob)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 s3=eo.S3(x=1,y=2,s="aa",b=True,ob=oc)
 r=echo.echoStruct2(s3)
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,ob])
-print r
+print(r)
 
 r=echo.echoObjectVec([oc,oc])
-print r
+print(r)
 
 r=echo.echoObjectVec([ob,oc])
-print r
+print(r)
 
 #echo.shutdown()
index 4d6e8b0503e34313bf929718d357894fc87d2548..fa42edb0d9f6e4d1df253c6598ca529dc6932378 100644 (file)
@@ -26,7 +26,7 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
        
-    print """
+    print("""
 <proc>
     <!-- types -->
     <!-- inline -->
@@ -34,9 +34,9 @@ def triangle(n):
 <inline name="node_0_0" >
 <script><code>
 import time
-from decimal import *"""
-    print "getcontext().prec = " + str(1+n/3)
-    print """
+from decimal import *""")
+    print("getcontext().prec = " + str(1+n/3))
+    print("""
 aa=Decimal(a)
 bb=Decimal(b)
 cc=aa+bb
@@ -47,47 +47,47 @@ time.sleep(1)
 <inport name="a" type="string"/>
 <inport name="b" type="string"/>
 <outport name="c" type="string"/>
-</inline>"""
+</inline>""")
 
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "import time"
-    print "from decimal import *"
-    print "getcontext().prec = " + str(1+n/3)
-    print "tot = Decimal(0)"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=Decimal(eval(v))"
-    print "print tot"
-    print "result=str(tot)"
-    print "ref=Decimal(2)**" + str(n)
-    print "reference=str(ref)"
-    print "time.sleep(1)"
-    print "</code></script>"
+<script><code>""")
+    print("import time")
+    print("from decimal import *")
+    print("getcontext().prec = " + str(1+n/3))
+    print("tot = Decimal(0)")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=Decimal(eval(v))")
+    print("print tot")
+    print("result=str(tot)")
+    print("ref=Decimal(2)**" + str(n))
+    print("reference=str(ref)")
+    print("time.sleep(1)")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="string"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="string"/>'
-    print '<outport name="reference" type="string"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="string"/>')
+    print('<outport name="reference" type="string"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -96,21 +96,21 @@ time.sleep(1)
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
     for i in range (n+1):
         fromnode="node_" + str(n)   +"_" + str(i)
         control='<control> <fromnode>'+fromnode+'</fromnode> <tonode>collect</tonode> </control>'
-        print control
+        print(control)
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -120,14 +120,14 @@ time.sleep(1)
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
     for i in range (n+1):
@@ -135,19 +135,19 @@ time.sleep(1)
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
         
         
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><string>0</string></value>
@@ -156,27 +156,27 @@ time.sleep(1)
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><string>1</string></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><string>0</string></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><string>0</string></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -188,7 +188,7 @@ if __name__ == "__main__":
         if rank <2:
             raise ValueError("rank must be >1")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d3e45b9c64cc0c1f5fe4ff2599584239e24a7eaf..4570fd13cef4f956678023075830a3023e3c834d 100644 (file)
@@ -45,43 +45,43 @@ def triangle(n):
     The last node gives the sum of rank n (=2**n) and also a direct calculation of 2**n.
     """
     
-    print debut
+    print(debut)
     
-    print """
+    print("""
 <inline name="collect" >
-<script><code>"""
-    print "tot = 0"
-    print "for i in range (" + str(n+1) + "):"
-    print "    v='a' + str(i)"
-    print "    tot+=eval(v)"
-    print "result=tot"
-    print "print result"
-    print "reference=2**" + str(n)
-    print "print reference"
-    print "</code></script>"
+<script><code>""")
+    print("tot = 0")
+    print("for i in range (" + str(n+1) + "):")
+    print("    v='a' + str(i)")
+    print("    tot+=eval(v)")
+    print("result=tot")
+    print("print result")
+    print("reference=2**" + str(n))
+    print("print reference")
+    print("</code></script>")
     for i in range (n+1):
         inport='<inport name="a' + str(i) + '" type="int"/>'
-        print inport
+        print(inport)
         pass
-    print '<outport name="result" type="int"/>'
-    print '<outport name="reference" type="int"/>'
-    print "</inline>"
-    print
+    print('<outport name="result" type="int"/>')
+    print('<outport name="reference" type="int"/>')
+    print("</inline>")
+    print()
     
     for i in range (1,n+1):
         for j in range (i+1):
             node="node_" + str(i)   +"_" + str(j)
             nodetxt='<node name="'+node+'" type="node_0_0"></node>'
-            print nodetxt
+            print(nodetxt)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- service -->
     <!-- control -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -90,16 +90,16 @@ def triangle(n):
             tonode2="node_" + str(i+1)   +"_" + str(j+1)
             control1='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode1+'</tonode> </control>'
             control2='<control> <fromnode>'+fromnode+'</fromnode> <tonode>'+tonode2+'</tonode> </control>'
-            print control1
-            print control2
+            print(control1)
+            print(control2)
             pass
         pass
 
-    print """
+    print("""
 
     <!-- datalinks -->
 
-    """
+    """)
     
     for i in range (n):
         for j in range (i+1):
@@ -109,14 +109,14 @@ def triangle(n):
             datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
             datato1 ='<tonode>'   + tonode1  + '</tonode> <toport>b</toport>'
             datato2 ='<tonode>'   + tonode2  + '</tonode> <toport>a</toport>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato1
-            print '</datalink>'
-            print '<datalink>'
-            print '   ' + datafrom
-            print '   ' + datato2
-            print '</datalink>'
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato1)
+            print('</datalink>')
+            print('<datalink>')
+            print('   ' + datafrom)
+            print('   ' + datato2)
+            print('</datalink>')
             pass
         pass
 
@@ -125,18 +125,18 @@ def triangle(n):
         datafrom='<fromnode>' + fromnode + '</fromnode> <fromport>c</fromport>'
         toport='a' + str(i)
         datato  ='<tonode>collect</tonode> <toport>' + toport + '</toport>'
-        print '<datalink>'
-        print '   ' + datafrom
-        print '   ' + datato
-        print '</datalink>'
+        print('<datalink>')
+        print('   ' + datafrom)
+        print('   ' + datato)
+        print('</datalink>')
     
-    print """
+    print("""
 
     <!--parameters -->
 
-    """
+    """)
 
-    print """
+    print("""
     <parameter>
         <tonode>node_0_0</tonode> <toport>a</toport>
         <value><int>0</int></value>
@@ -145,27 +145,27 @@ def triangle(n):
         <tonode>node_0_0</tonode> <toport>b</toport>
         <value><int>1</int></value>
     </parameter>
-    """
+    """)
 
     for i in range (1,n+1):
         node1="node_" + str(i)   +"_" + str(0)
         node2="node_" + str(i)   +"_" + str(i)
         tonode1 ='   <tonode>' + node1 + '</tonode> <toport>a</toport>'
         tonode2 ='   <tonode>' + node2 + '</tonode> <toport>b</toport>'
-        print '<parameter>'
-        print tonode1
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode1)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
         
-        print '<parameter>'
-        print tonode2
-        print '   <value><int>0</int></value>'
-        print '</parameter>'
+        print('<parameter>')
+        print(tonode2)
+        print('   <value><int>0</int></value>')
+        print('</parameter>')
 
-    print """
+    print("""
 
 </proc>
-    """
+    """)
      
 if __name__ == "__main__":
     import sys
@@ -179,7 +179,7 @@ if __name__ == "__main__":
         if rank >31:
             raise ValueError("rank must be <32")
     except (IndexError, ValueError):
-        print usage%(sys.argv[0])
+        print(usage%(sys.argv[0]))
         sys.exit(1)
         pass
     triangle(rank)
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index d43d070b34d77a30460fb7da46d12ba93ce23298..9cf592a8dd18ef832976bbeb5993f28b05e5abf9 100644 (file)
@@ -33,11 +33,11 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     """Optional method called on initialization.
        The type of "input" is returned by "getTCForAlgoInit"
     """
-    print "Algo initialize, input = ", input.getIntValue()
+    print("Algo initialize, input = ", input.getIntValue())
 
   def start(self):
     """Start to fill the pool with samples to evaluate."""
-    print "Algo start "
+    print("Algo start ")
     self.iter=0
     # pushInSample(id, value)
     self.pool.pushInSample(self.iter, 1)
@@ -50,7 +50,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
     currentId=self.pool.getCurrentId()
     valIn = self.pool.getCurrentInSample().getIntValue()
     valOut = self.pool.getCurrentOutSample().getIntValue()
-    print "Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut)
+    print("Algo takeDecision currentId=%s, valIn=%s, valOut=%s" % (currentId, valIn, valOut))
 
     self.iter=self.iter+1
     if self.iter < 3:
@@ -61,7 +61,7 @@ class myalgosync(SALOMERuntime.OptimizerAlgSync):
   def finish(self):
     """Optional method called when the algorithm has finished, successfully
        or not, to perform any necessary clean up."""
-    print "Algo finish"
+    print("Algo finish")
     self.pool.destroyAll()
 
   def getAlgoResult(self):
index d172415f19e5a5c4d838fff97abf0814e2b02370..c9f8d1b491101a7a28639232cf25574d21fbca79 100755 (executable)
@@ -34,30 +34,30 @@ class TestEdit(unittest.TestCase):
 
     def test1_edit(self):
         p = self.r.createProc("pr")
-        print p.typeMap
+        print(p.typeMap)
         t=p.getTypeCode("double")
-        print t.kind()
+        print(t.kind())
         t=p.typeMap["double"]
         
         td=p.createType("double","double")
         ti=p.createType("int","int")
         tc1=p.createInterfaceTc("","Obj",[])
-        print tc1.name(),tc1.id()
+        print(tc1.name(),tc1.id())
         tc2=p.createInterfaceTc("","Obj2",[tc1])
-        print tc2.name(),tc2.id()
+        print(tc2.name(),tc2.id())
         tc3=p.createSequenceTc("","seqdbl",td)
-        print tc3.name(),tc3.id(),tc3.contentType()
+        print(tc3.name(),tc3.id(),tc3.contentType())
         tc4=p.createSequenceTc("","seqObj2",tc2)
         tc5=p.createSequenceTc("","seqint",ti)
-        print tc4.name(),tc4.id()
-        print tc4.isA(tc1),0
-        print tc2.isA(tc1),1
-        print tc1.isA(tc2),0
-        print td.isA(ti),0
-        print td.isAdaptable(ti),1
-        print ti.isAdaptable(td),0
-        print tc5.isAdaptable(tc3),0
-        print tc3.isAdaptable(tc5),1
+        print(tc4.name(),tc4.id())
+        print(tc4.isA(tc1),0)
+        print(tc2.isA(tc1),1)
+        print(tc1.isA(tc2),0)
+        print(td.isA(ti),0)
+        print(td.isAdaptable(ti),1)
+        print(ti.isAdaptable(td),0)
+        print(tc5.isAdaptable(tc3),0)
+        print(tc3.isAdaptable(tc5),1)
         
         n=self.r.createScriptNode("","node1")
         n.setScript("print 'coucou1'")
@@ -68,13 +68,13 @@ class TestEdit(unittest.TestCase):
         retex=None
         try:
             inport.edInitXML("<value><intt>5</int></value>")
-        except ValueError, ex:
-            print "Value Error: ", ex
+        except ValueError as ex:
+            print("Value Error: ", ex)
             retex=ex
-        except pilot.Exception,ex:
-            print "YACS exception:",ex.what()
+        except pilot.Exception as ex:
+            print("YACS exception:",ex.what())
             retex=ex.what()
-        self.assert_(retex is not None, "exception not raised, or wrong type")
+        self.assertTrue(retex is not None, "exception not raised, or wrong type")
         inport.edInitXML("<value><int>5</int></value>")
 
         # --- create script node node2
@@ -188,8 +188,8 @@ def f():
 
         try:
           self.e.RunW(p,0)
-        except pilot.Exception,ex:
-          print ex.what()
+        except pilot.Exception as ex:
+          print(ex.what())
           self.fail(ex)
         
         #self.e.displayDot(p)
index ca5a953ae33c083e5165ab56e8e14d0e82ecb5ce..e6725579a7afd6aa18a05f2b5ddd85eb26c5d064 100755 (executable)
@@ -38,7 +38,7 @@ class TestExec(unittest.TestCase):
     def test1_StepByStep(self):
         # --- execution step by step
        
-        print "================= Start of STEPBYSTEP ==================="
+        print("================= Start of STEPBYSTEP ===================")
         self.e.setExecMode(1) # YACS::STEPBYSTEP
         
         run1 = threading.Thread(None, self.e.RunPy, "stepbystep", (self.p,0))
@@ -51,7 +51,7 @@ class TestExec(unittest.TestCase):
             self.e.waitPause()
             #e.displayDot(p)
             bp = self.e.getTasksToLoad()
-            print "nexts possible steps = ", bp
+            print("nexts possible steps = ", bp)
             if len(bp) > 0:
                 tte= bp[-1:] # only one node at each step, the last one in the list
                 r = self.e.setStepsToExecute(tte)
@@ -60,7 +60,7 @@ class TestExec(unittest.TestCase):
             else:
                 tocont = False
                 pass
-            print "toContinue = ", tocont
+            print("toContinue = ", tocont)
             pass
         
         self.e.resumeCurrentBreakPoint()
@@ -73,13 +73,13 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of STEPBYSTEP ====================="
+        print("================= End of STEPBYSTEP =====================")
         pass
 
     def test2_StopToBreakpoint(self):
         # --- start execution, set a breakpoint before node48, then continue
         time.sleep(1)
-        print "================= Start of BREAKPOINT ==================="
+        print("================= Start of BREAKPOINT ===================")
         brp=['node48']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -88,9 +88,9 @@ class TestExec(unittest.TestCase):
         time.sleep(0.1)
         self.e.waitPause()
         #self.e.displayDot(p)
-        print "================= reach BREAKPOINT ======================"
+        print("================= reach BREAKPOINT ======================")
         # --- resume from breakpoint
-        print "=========== BREAKPOINT, start RESUME ===================="
+        print("=========== BREAKPOINT, start RESUME ====================")
         time.sleep(1)
         self.e.setExecMode(0) # YACS::CONTINUE
         self.e.resumeCurrentBreakPoint()
@@ -106,14 +106,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of RESUME ========================="
+        print("================= End of RESUME =========================")
         pass
     
     def test3_RunWithoutBreakpoints(self):
         # --- start execution, run without breakpoints
         time.sleep(1)
         
-        print "================= Start of CONTINUE ====================="
+        print("================= Start of CONTINUE =====================")
         self.e.setExecMode(0) # YACS::CONTINUE
         run3 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run3.start()
@@ -129,14 +129,14 @@ class TestExec(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('c0.c1.n1').getEffectiveState())
         self.assertEqual(999, self.p.getChildByName('c0.n2').getEffectiveState())
         self.assertEqual(888, self.p.getChildByName('node62').getEffectiveState())
-        print "================= End of CONTINUE ======================="
+        print("================= End of CONTINUE =======================")
         pass
 
     def test4_StopOnError(self):
         # --- stop execution on first error and save state
         time.sleep(1)
 
-        print "================= Start of STOPONERROR =================="
+        print("================= Start of STOPONERROR ==================")
         self.e.setStopOnError()
         run4 = threading.Thread(None, self.e.RunPy, "continue", (self.p,0))
         run4.start()
@@ -148,15 +148,15 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         s13 = self.p.getChildByName('node13').getEffectiveState()
         s43 = self.p.getChildByName('node43').getEffectiveState()
-        self.assert_((s13==999) or (s43==999))
-        print "================= End of STOPONERROR ====================="
+        self.assertTrue((s13==999) or (s43==999))
+        print("================= End of STOPONERROR =====================")
         pass
 
     def test5_PartialExec(self):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['node35']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -173,7 +173,7 @@ class TestExec(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(106, self.p.getChildByName('node34').getEffectiveState())
         self.assertEqual(101, self.p.getChildByName('node35').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
                           
     pass
index 42c5adcbf50a89b5e2f1a3ce527a5242bee819c8..5264c98e5ef376b26ca516e3a5adaf4c2af96f63 100755 (executable)
@@ -41,13 +41,13 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("nonexisting")
-    except IOError, ex:
-      print "IO Error: ", ex
+    except IOError as ex:
+      print("IO Error: ", ex)
       retex=ex
     #except pilot.invalid_argument,ex:
     #  print "invalid_argument:",ex.what()
     #  retex=ex.what()
-    self.assert_(retex is not None, "exception not raised, or wrong type")
+    self.assertTrue(retex is not None, "exception not raised, or wrong type")
     pass
 
   def test2_parseError(self):
@@ -55,29 +55,29 @@ class TestLoader(unittest.TestCase):
     retex=None
     try:
       p = self.l.load("samples/bid.xml")
-    except ValueError,ex:
-      print "Caught ValueError Exception:",ex
+    except ValueError as ex:
+      print("Caught ValueError Exception:",ex)
       retex = ex
     expected="LogRecord: parser:ERROR:from node node5 does not exist in control link: node5->b2 context: b1. (samples/bid.xml:53)\n"
-    self.assert_(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
+    self.assertTrue(p.getLogger("parser").getStr() == expected, "error not found: "+p.getLogger("parser").getStr())
     pass
 
   def test3_normal(self):
     # --- File exists and no parsing problem
     try:
       p = self.l.load("samples/aschema.xml")
-      print p.getLogger("parser").getStr()
-      print p
-      print p.getName()
-      for k in p.typeMap: print k
-      for k in p.nodeMap: print k
-      for k in p.inlineMap: print k
-      for k in p.serviceMap: print k
-      print self.e.getTasksToLoad()
+      print(p.getLogger("parser").getStr())
+      print(p)
+      print(p.getName())
+      for k in p.typeMap: print(k)
+      for k in p.nodeMap: print(k)
+      for k in p.inlineMap: print(k)
+      for k in p.serviceMap: print(k)
+      print(self.e.getTasksToLoad())
       self.e.RunW(p,0)
       self.assertEqual(106, p.getChildByName('node48').getEffectiveState())
-    except pilot.Exception,ex:
-      print "YACS exception:",ex
+    except pilot.Exception as ex:
+      print("YACS exception:",ex)
       self.fail(ex)
       pass
     pass
index 700b43b0266de2025448060db47764614fd1e0ec..efd29c7827edc416211bedd56c15741ae8043054 100755 (executable)
@@ -31,14 +31,14 @@ class TestContainerRef(unittest.TestCase):
     """test delete following creation from class"""
     co=self.r.createContainer()
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test1(self):
     """test delete following creation from createContainer and delitem from containerMap"""
     co=self.p.createContainer("c2")
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -49,7 +49,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c2")
     self.p.containerMap["c2"]=co
     del self.p.containerMap["c2"]
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
     del co
 
@@ -61,7 +61,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c9"]
     self.assertEqual(co.getName(), "c9")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test4(self):
@@ -70,7 +70,7 @@ class TestContainerRef(unittest.TestCase):
     del self.p.containerMap["c10"]
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test5(self):
@@ -79,19 +79,19 @@ class TestContainerRef(unittest.TestCase):
     del self.p
     self.assertEqual(co.getName(), "c10")
     self.assertEqual(co.getRefCnt(), 1)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
 
   def test6(self):
     """test ownership of container on getitem from containerMap"""
     co=self.p.createContainer("c8")
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     co=self.p.containerMap["c8"]
     self.assertEqual(co.getRefCnt(), 2)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     del co
     self.assertEqual(self.p.containerMap["c8"].getRefCnt(), 2) # +1 for getitem
     del self.p.containerMap["c8"]
@@ -121,22 +121,22 @@ class TestContainerRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createContainer("c8")
-    for co in self.p.containerMap.values():
-      self.assert_(co.thisown)
+    for co in list(self.p.containerMap.values()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createContainer("c8")
-    for k,co in self.p.containerMap.items():
-      self.assert_(co.thisown)
+    for k,co in list(self.p.containerMap.items()):
+      self.assertTrue(co.thisown)
       self.assertEqual(co.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     co=self.p.createContainer("c8")
     self.p.containerMap.clear()
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 1)
 
   def test12(self):
@@ -144,7 +144,7 @@ class TestContainerRef(unittest.TestCase):
     co=self.p.createContainer("c8")
     d={"c1":co}
     self.p.containerMap.update(d)
-    self.assert_(co.thisown)
+    self.assertTrue(co.thisown)
     self.assertEqual(co.getRefCnt(), 3)
 
 class TestTypeCodeRef(unittest.TestCase):
@@ -156,13 +156,13 @@ class TestTypeCodeRef(unittest.TestCase):
     """test delete following creation from createSequenceTc"""
     tc=pilot.TypeCode(pilot.Double)
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test1(self):
     """test delete following creation from createInterfaceTc and delitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test2(self):
@@ -172,7 +172,7 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap["obj"]=tc
     del self.p.typeMap["obj"]
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test3(self):
@@ -182,32 +182,32 @@ class TestTypeCodeRef(unittest.TestCase):
     self.assertEqual(tc.getRefCnt(), 2)
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test4(self):
     """test delete from typeMap following creation from createInterfaceTc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test5(self):
     """test existence TypeCode following delete proc"""
     tc=self.p.createInterfaceTc("","obj",[])
     del self.p
     self.assertEqual(tc.getRefCnt(), 1)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
 
   def test6(self):
     """test ownership of TypeCode on getitem from typeMap"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     tc=self.p.typeMap["obj"]
     self.assertEqual(tc.getRefCnt(), 2)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     del tc
     self.assertEqual(self.p.typeMap["obj"].getRefCnt(), 2) # +1 for getitem
     del self.p.typeMap["obj"]
@@ -237,24 +237,24 @@ class TestTypeCodeRef(unittest.TestCase):
   def test9(self):
     """test method values"""
     self.p.createInterfaceTc("","obj",[])
-    for tc in self.p.typeMap.values():
+    for tc in list(self.p.typeMap.values()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test10(self):
     """test method items"""
     self.p.createInterfaceTc("","obj",[])
-    for k,tc in self.p.typeMap.items():
+    for k,tc in list(self.p.typeMap.items()):
       if tc.name()!="obj":continue
-      self.assert_(tc.thisown)
+      self.assertTrue(tc.thisown)
       self.assertEqual(tc.getRefCnt(), 2)
 
   def test11(self):
     """test method clear"""
     tc=self.p.createInterfaceTc("","obj",[])
     self.p.typeMap.clear()
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 1)
 
   def test12(self):
@@ -262,7 +262,7 @@ class TestTypeCodeRef(unittest.TestCase):
     tc=self.p.createInterfaceTc("","obj",[])
     d={"c1":tc}
     self.p.typeMap.update(d)
-    self.assert_(tc.thisown)
+    self.assertTrue(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 3)
 
 if __name__ == '__main__':
index de5c7ed541350df2c92b7c4d97fe9660d2097cc7..f796f72cb06d9cc7181fcb3229199f31830922c8 100755 (executable)
@@ -39,7 +39,7 @@ class TestResume(unittest.TestCase):
         # --- stop execution after breakpoint
         time.sleep(1)
 
-        print "================= Start of PARTIALEXEC ==================="
+        print("================= Start of PARTIALEXEC ===================")
         brp=['b1.b2.node1']
         self.e.setListOfBreakPoints(brp)
         self.e.setExecMode(2) # YACS::STOPBEFORENODES
@@ -55,14 +55,14 @@ class TestResume(unittest.TestCase):
         #self.e.displayDot(self.p)
         self.assertEqual(101, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.node1').getEffectiveState())
-        print "================= reach BREAKPOINT PARTIAL EXEC =========="
+        print("================= reach BREAKPOINT PARTIAL EXEC ==========")
         pass
 
     def test2_ExecFromLoadState(self):
         # --- reload state from previous partial execution then exec
         time.sleep(1)
 
-        print "================= Start of EXECLOADEDSTATE ==============="
+        print("================= Start of EXECLOADEDSTATE ===============")
         sp = loader.stateParser()
         sl = loader.stateLoader(sp,self.p)
         sl.parse('dumpPartialBloc2.xml')
@@ -81,7 +81,7 @@ class TestResume(unittest.TestCase):
         self.assertEqual(106, self.p.getChildByName('b1.b2.node1').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.node2').getEffectiveState())
         self.assertEqual(106, self.p.getChildByName('b1.b2.loop1.node1').getEffectiveState())
-        print "================= End of EXECLOADEDSTATE ================="
+        print("================= End of EXECLOADEDSTATE =================")
                           
     pass
 
index be71e8bc24d378f3ceb46cdc3eb68813d9bff066..644c8d8b427a028a8d9c26d38a1396764103e539 100755 (executable)
@@ -69,12 +69,12 @@ class TestSave(unittest.TestCase):
                 s.save(saveSchema2)
                 e.RunW(p,0)
                 e.saveState(dumpSchema2)
-            except ValueError, ex:
-                print "Value Error: ", ex
+            except ValueError as ex:
+                print("Value Error: ", ex)
                 pb = "problem on " + fileOrig + " : ValueError"
                 self.fail(pb)
-            except pilot.Exception,ex:
-                print ex.what()
+            except pilot.Exception as ex:
+                print(ex.what())
                 pb = "problem on " + fileOrig + " : " + ex.what()
                 self.fail(pb)
             except:
index 95c07735cf7fbab5662a8ce6182f22419f06edfe..86a710316ad0e9212448cb6086026e9aa6f1fdb8 100755 (executable)
@@ -71,7 +71,7 @@ for i in xrange(i1):
     pass
 print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
 """
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       node0=self.r.createFuncNode("DistPython","node%i"%(i))
       p.edAddChild(node0)
       node0.setFname("ff")
@@ -109,17 +109,17 @@ print "coucou from script1-%i  -> %s"%(dbg,str(datetime.datetime.now()-ref))
     st=datetime.datetime.now()
     # 1st exec
     ex.RunW(p,0)
-    print "Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 1st %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 2nd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec using the same already launched remote python interpreters
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test0 to run 3rd %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -168,7 +168,7 @@ print "coucou %lf from script1-%i  -> %s"%(aa,dbg,str(datetime.datetime.now()-re
 aa+=1.
 """
     #
-    for i in xrange(nbOfNodes):
+    for i in range(nbOfNodes):
       nodeMiddle=self.r.createFuncNode("Salome","node%i_1"%(i)) # PyFuncNode remote
       p.edAddChild(nodeMiddle)
       nodeMiddle.setFname("ff")
@@ -198,17 +198,17 @@ aa+=1.
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test1 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     pass
 
@@ -292,19 +292,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test2 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -389,19 +389,19 @@ o3=0
     self.assertEqual(p.getState(),pilot.READY)
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 1st run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 2nd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 2nd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     # 3rd exec
     st=datetime.datetime.now()
     ex.RunW(p,0)
-    print "Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st))
+    print("Time spend of test3 to 3rd run %s"%(str(datetime.datetime.now()-st)))
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertAlmostEqual(refExpected,o9.getPyObj(),5)
     pass
@@ -620,8 +620,8 @@ for i in xrange(nb):
     self.assertEqual(n1.getState(),pilot.DONE)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(6))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L, 12L, 16L, 18L, -4L, 10L]])
+    self.assertEqual(a,list(range(6)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6, 12, 16, 18, -4, 10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -680,8 +680,8 @@ else:
     self.assertEqual(n1.getState(),pilot.FAILED)
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
-    self.assertEqual(a,range(3))
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L]])
+    self.assertEqual(a,list(range(3)))
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -745,7 +745,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -767,7 +767,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,2,3,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,16L,18L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,16,18,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     pass
 
@@ -833,7 +833,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[0,1,2,4,5])
-    self.assertEqual([elt.getPyObj() for elt in b],[[6L,12L,16L,-4L,10L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[6,12,16,-4,10]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -851,7 +851,7 @@ o2=7*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6L,12L,16L,63L,-4L,10L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[6,12,16,63,-4,10])
     pass
 
   def test10(self):
@@ -915,7 +915,7 @@ else:
     n1.edGetSeqOfSamplesPort().getPyObj()
     a,b,c=n1.getPassedResults(ex)
     self.assertEqual(a,[1,3,5,7,9,11])
-    self.assertEqual([elt.getPyObj() for elt in b],[[12L,36L,60L,84L,108L,132L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[12,36,60,84,108,132]])
     self.assertEqual(c,['n10_o2_interceptor'])
     
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -937,7 +937,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,12L,30L,36L,60L,60L,90L,84L,120L,108L,150L,132L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,12,30,36,60,60,90,84,120,108,150,132])
     pass
 
   pass
@@ -1006,7 +1006,7 @@ else:
     a,b,c=n1.getPassedResults(ex)
 
     self.assertEqual(a,[0,2,4,6,8,10])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,4L,8L,12L,16L,20L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,4,8,12,16,20]])
     
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(12) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1029,7 +1029,7 @@ else:
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,5L,4L,15L,8L,25L,12L,35L,16L,45L,20L,55L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,5,4,15,8,25,12,35,16,45,20,55])
     pass
   
   def test12(self):
@@ -1122,14 +1122,14 @@ for i in i8:
     #
     node0=self.r.createForEachLoop("ForEachLoop_int0",ti)
     p.edAddChild(node0)
-    node0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node0.edGetNbOfBranchesPort().edInitInt(2)
     #
     node00=self.r.createBloc("Bloc0")
     node0.edAddChild(node00)
     node000_0=self.r.createForEachLoop("ForEachLoop_int1",ti)
     node00.edAddChild(node000_0)
-    node000_0.edGetSeqOfSamplesPort().edInitPy(range(4))
+    node000_0.edGetSeqOfSamplesPort().edInitPy(list(range(4)))
     node000_0.edGetNbOfBranchesPort().edInitInt(3)
     #
     node0000=self.r.createBloc("Bloc1")
@@ -1191,7 +1191,7 @@ for i in i8:
     #
     n00.edAddLink(n000.edGetSamplePort(),i0)
     #
-    n000.edGetSeqOfSamplesPort().edInitPy(range(10))
+    n000.edGetSeqOfSamplesPort().edInitPy(list(range(10)))
     n000.edGetNbOfBranchesPort().edInitInt(2)
     #
     n01=r.createScriptNode("Salome","test23/check") ; n0bis.edAddChild(n01)
@@ -1223,7 +1223,7 @@ for i in i8:
     #
     nb=4
     outs=[]
-    for i in xrange(nb):
+    for i in range(nb):
       node=self.r.createScriptNode("Salome","node%d"%i)
       node.setExecutionMode("remote")
       node.setContainer(cont)
@@ -1237,7 +1237,7 @@ for i in i8:
     res=node.edAddOutputPort("res",ti)
     p.edAddChild(node)
     l=[]
-    for i in xrange(nb):
+    for i in range(nb):
       elt="i%d"%i
       inp=node.edAddInputPort(elt,ti) ; l.append(elt)
       p.edAddChild(node)
@@ -1245,7 +1245,7 @@ for i in i8:
     node.setScript("res="+"+".join(l))
     p.edAddCFLink(b,node)
     #
-    for i in xrange(10):
+    for i in range(10):
       p.init()
       ex = pilot.ExecutorSwig()
       self.assertEqual(p.getState(),pilot.READY)
@@ -1524,7 +1524,7 @@ o2=2*i1
     self.assertEqual(p.getState(),pilot.DONE)
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(a,[0,1])
-    self.assertEqual([elt.getPyObj() for elt in b],[[0L,2L]])
+    self.assertEqual([elt.getPyObj() for elt in b],[[0,2]])
     #
     p.getChildByName("n0").setScript("o0=[ 3*elt for elt in range(6) ]")
     p.getChildByName("n1").getChildByName("n10").setScript("""
@@ -1543,7 +1543,7 @@ o2=5*i1
     #
     self.assertEqual(n1.getState(),pilot.DONE)
     self.assertEqual(p.getState(),pilot.DONE)
-    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0L,2L,10L,15L,20L,25L])
+    self.assertEqual(p.getChildByName("n2").getOutputPort("o4").getPyObj(),[0,2,10,15,20,25])
     pass
   pass
 
index 5efb5ae637da01802cad5c4e1d13df48ba92f874..7b64c77d346b7477a8b7d1e00ed4fdfef6aa04f5 100644 (file)
@@ -40,7 +40,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res.xml")
@@ -53,10 +53,10 @@ for name in names:
     i+=1
     pass
 
-print procEx.getOutPortValue(dico["poly_7"],"Pn")
-print procEx.getInPortValue(dico["poly_7"],"x")
-print procEx.getInPortValue(dico["poly_7"],"notAPort")
-print procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps")
+print(procEx.getOutPortValue(dico["poly_7"],"Pn"))
+print(procEx.getInPortValue(dico["poly_7"],"x"))
+print(procEx.getInPortValue(dico["poly_7"],"notAPort"))
+print(procEx.getInPortValue(dico["Legendre.loopIter"],"nsteps"))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors (echoSrv must be launched)
@@ -72,7 +72,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("res2.xml")
@@ -85,8 +85,8 @@ for name in names:
     i+=1
     pass
 
-print procEx.getErrorDetails(dico["c1"])
-print procEx.getErrorDetails(dico["node13"])
+print(procEx.getErrorDetails(dico["c1"]))
+print(procEx.getErrorDetails(dico["node13"]))
 
 # -----------------------------------------------------------------------------
 # --- schema with errors
@@ -102,7 +102,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 #procEx.resumeCurrentBreakPoint()
@@ -122,7 +122,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("partialExec.xml")
@@ -136,7 +136,7 @@ while isRunning:
     time.sleep(0.5)
     state = procEx.getExecutorState()
     isRunning = (state < 304)
-    print "executorState: ", state
+    print("executorState: ", state)
     pass
 
 procEx.saveState("finishExec.xml")
index 79b88b0f879585f92bb82ff4c5c1fb965622d273..5ce0f7ff68b1797cbe6dd146c0ba407ac5c90b2d 100644 (file)
@@ -100,9 +100,9 @@ class proc_i(YACS_ORB__POA.ProcExec):
         return self.p.getIds()
 
     def runProc(self,debug, isPyThread, fromscratch):
-      print "**************************Begin schema execution %s**************************" % self.xmlFile
+      print("**************************Begin schema execution %s**************************" % self.xmlFile)
       self.e.RunPy(self.p,debug, isPyThread, fromscratch)
-      print "**************************End schema execution %s****************************" % self.xmlFile
+      print("**************************End schema execution %s****************************" % self.xmlFile)
 
     def Run(self):
         if self.run1 is not None:
@@ -132,17 +132,17 @@ class proc_i(YACS_ORB__POA.ProcExec):
             sp = loader.stateParser()
             sl = loader.stateLoader(sp,self.p)
             sl.parse(xmlFile)
-          except IOError, ex:
-            print "IO Error: ", ex
+          except IOError as ex:
+            print("IO Error: ", ex)
             return
-          except ValueError,ex:
-            print "Caught ValueError Exception:",ex
+          except ValueError as ex:
+            print("Caught ValueError Exception:",ex)
             return
-          except pilot.Exception,ex:
-            print ex.what()
+          except pilot.Exception as ex:
+            print(ex.what())
             return
           except:
-            print "Unknown exception!"
+            print("Unknown exception!")
             return
 
         if self.run1 is None:
@@ -240,7 +240,7 @@ class YACS(YACS_ORB__POA.YACS_Gen,
     """
     def __init__ ( self, orb, poa, contID, containerName, instanceName,
                    interfaceName ):
-        print "YACS.__init__: ", containerName, ';', instanceName
+        print("YACS.__init__: ", containerName, ';', instanceName)
         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa, contID,
                                                          containerName, instanceName,
                                                          interfaceName, False)
@@ -283,18 +283,18 @@ class YACS(YACS_ORB__POA.YACS_Gen,
             procExec_i = proc_i(xmlFile)
             logger=procExec_i.p.getLogger("parser")
             if not logger.isEmpty():
-              print "The imported file has errors :"
-              print logger.getStr()
+              print("The imported file has errors :")
+              print(logger.getStr())
               sys.stdout.flush()
               return None
-        except IOError, ex:
-            print >> sys.stderr ,"IO Error: ", ex
+        except IOError as ex:
+            print("IO Error: ", ex, file=sys.stderr)
             return None
-        except ValueError,ex:
-            print >> sys.stderr ,"Caught ValueError Exception:",ex
+        except ValueError as ex:
+            print("Caught ValueError Exception:",ex, file=sys.stderr)
             return None
-        except pilot.Exception,ex:
-            print >> sys.stderr ,ex.what()
+        except pilot.Exception as ex:
+            print(ex.what(), file=sys.stderr)
             return None
         except:
             traceback.print_exc()