DebugClients/Python/DebugUtilities.py

Sat, 03 Sep 2016 18:02:37 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Sep 2016 18:02:37 +0200
branch
jsonrpc
changeset 5132
a094eee9f862
permissions
-rw-r--r--

Ported the debugger modernization changes to the Python 2 debugger.

# -*- coding: utf-8 -*-

# Copyright (c) 2016 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing utilities functions for the debug client.
"""


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: FileType = Python2
# eflag: noqa = M702

eric ide

mercurial