Browse Source

Make 2to3 changes.

Bentley James Oakes 3 years ago
parent
commit
1f216c0a6a
2 changed files with 16 additions and 10 deletions
  1. 16 9
      wrappers/modelverse_SCCD.py
  2. 0 1
      wrappers/modelverse_SCCD.xml

+ 16 - 9
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Tue Nov 28 16:51:54 2017
+Date:   Thu Mar  1 21:32:22 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
@@ -15,10 +15,14 @@ import time
 import os
 import sys
 import uuid
-import urllib
 import json
 import sys
 
+try:
+    from urllib.parse import urlencode as urlencode
+except Exception:
+    from urllib import urlencode as urlencode
+
 # package "MvK Server"
 
 class Modelverse(RuntimeClassBase):
@@ -64,7 +68,7 @@ class Modelverse(RuntimeClassBase):
     # user defined method
     def dict_to_list(self, d):
         l = []
-        for k, v in d.iteritems():
+        for k, v in d.items():
             l.append(k)
             l.append(v)
         l.append("")
@@ -2271,7 +2275,7 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_http_mapper_init_0_exec(self, parameters):
         value = parameters[0]
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[0], Event("HTTP_input", None, [urllib.urlencode({"op": "set_input", "data": json.dumps(value), "taskname": self.taskname}), None])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[0], Event("HTTP_input", None, [urlencode({"op": "set_input", "data": json.dumps(value), "taskname": self.taskname}), None])]))
     
     def _initialized_http_mapper_init_0_guard(self, parameters):
         value = parameters[0]
@@ -2279,7 +2283,7 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_http_mapper_init_1_exec(self, parameters):
         value = parameters[0]
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[0], Event("HTTP_input", None, [urllib.urlencode({"op": "set_input", "value": json.dumps(value), "taskname": self.taskname}), None])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[0], Event("HTTP_input", None, [urlencode({"op": "set_input", "value": json.dumps(value), "taskname": self.taskname}), None])]))
     
     def _initialized_http_mapper_init_1_guard(self, parameters):
         value = parameters[0]
@@ -2289,11 +2293,11 @@ class Modelverse(RuntimeClassBase):
         value = parameters[0]
         taskname = parameters[1]
         http_client = parameters[2]
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[http_client], Event("HTTP_input", None, [urllib.urlencode({"op": "set_input", "value": json.dumps(value), "taskname": taskname}), "parent"])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[http_client], Event("HTTP_input", None, [urlencode({"op": "set_input", "value": json.dumps(value), "taskname": taskname}), "parent"])]))
     
     def _initialized_http_mapper_init_3_exec(self, parameters):
         data = parameters[0]
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urllib.urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
         self.responses.append(json.loads(data))
         #print("Got data at %s: %s" % (self.controller.taskname, str(json.loads(data))))
     
@@ -2303,7 +2307,7 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_http_mapper_init_4_exec(self, parameters):
         data = parameters[0]
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urllib.urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
         self.responses.append(json.loads(data))
     
     def _initialized_http_mapper_init_4_guard(self, parameters):
@@ -2317,7 +2321,7 @@ class Modelverse(RuntimeClassBase):
         return self.i < 2
     
     def _initialized_behaviour_init_connect_http_client_1_exec(self, parameters):
-        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urllib.urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
+        self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
         self.raiseInternalEvent(Event("result", None, [[]]))
     
     def _initialized_behaviour_init_connect_http_client_1_guard(self, parameters):
@@ -3507,6 +3511,9 @@ class HTTPClient(RuntimeClassBase):
     def _connected_listening_listen_0_exec(self, parameters):
         socket = parameters[0]
         data = parameters[1]
+        if sys.version_info[0] > 2:
+            if isinstance(data, bytes):
+                data = data.decode()
         self.received_data += data
     
     def _connected_listening_listen_0_guard(self, parameters):

+ 0 - 1
wrappers/modelverse_SCCD.xml

@@ -9,7 +9,6 @@
         import os
         import sys
         import uuid
-        import urllib
         import json
         import sys