DebugClients/Python3/DebugUtilities.py

branch
debugger speed
changeset 5174
8c48f5e0cd92
parent 5129
e4ab234cf071
diff -r fb9168c2e069 -r 8c48f5e0cd92 DebugClients/Python3/DebugUtilities.py
--- a/DebugClients/Python3/DebugUtilities.py	Thu Sep 15 21:49:13 2016 +0200
+++ b/DebugClients/Python3/DebugUtilities.py	Sun Sep 18 21:35:53 2016 +0200
@@ -123,5 +123,27 @@
         argvalues += " -> " + formatvalue(locals['__return__'])
     return argvalues
 
+
+def prepareJsonCommand(method, params):
+    """
+    Function to prepare a single command or response for transmission to
+    the IDE.
+    
+    @param method command or response name to be sent
+    @type str
+    @param params dictionary of named parameters for the command or response
+    @type dict
+    @return prepared JSON command or response string
+    @rtype str
+    """
+    import json
+    
+    commandDict = {
+        "jsonrpc": "2.0",
+        "method": method,
+        "params": params,
+    }
+    return json.dumps(commandDict) + '\n'
+
 #
 # eflag: noqa = M702

eric ide

mercurial