DebugClients/Python2/DebugUtilities.py

Sat, 03 Sep 2016 18:24:50 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Sep 2016 18:24:50 +0200
branch
jsonrpc
changeset 5134
4a4212a6f40c
parent 5133
b7fe69c6cb1c
permissions
-rw-r--r--

Removed two obsolete modules in the Python 2 debugger.

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

eric ide

mercurial