DebugClients/Python/DebugUtilities.py

branch
jsonrpc
changeset 5132
a094eee9f862
equal deleted inserted replaced
5131:889ed5ff7a68 5132:a094eee9f862
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing utilities functions for the debug client.
8 """
9
10
11 def prepareJsonCommand(method, params):
12 """
13 Function to prepare a single command or response for transmission to
14 the IDE.
15
16 @param method command or response name to be sent
17 @type str
18 @param params dictionary of named parameters for the command or response
19 @type dict
20 @return prepared JSON command or response string
21 @rtype str
22 """
23 import json
24
25 commandDict = {
26 "jsonrpc": "2.0",
27 "method": method,
28 "params": params,
29 }
30 return json.dumps(commandDict) + '\n'
31
32 #
33 # eflag: FileType = Python2
34 # eflag: noqa = M702

eric ide

mercurial