diff options
author | 2015-06-24 14:03:29 +0300 | |
---|---|---|
committer | 2015-06-24 14:03:29 +0300 | |
commit | 8b52a31ed2c299b759f330c4f976b9c70f5765f4 (patch) | |
tree | 9d6da5438b5b56b1d2d57e6c13494b4e65d000e7 /scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py |
first version
Diffstat (limited to 'scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py')
-rwxr-xr-x | scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py new file mode 100755 index 00000000..4d28f1b1 --- /dev/null +++ b/scripts/automation/trex_control_plane/python_lib/jsonrpclib-0.1.3/jsonrpclib/config.py @@ -0,0 +1,38 @@ +import sys + +class LocalClasses(dict): + def add(self, cls): + self[cls.__name__] = cls + +class Config(object): + """ + This is pretty much used exclusively for the 'jsonclass' + functionality... set use_jsonclass to False to turn it off. + You can change serialize_method and ignore_attribute, or use + the local_classes.add(class) to include "local" classes. + """ + use_jsonclass = True + # Change to False to keep __jsonclass__ entries raw. + serialize_method = '_serialize' + # The serialize_method should be a string that references the + # method on a custom class object which is responsible for + # returning a tuple of the constructor arguments and a dict of + # attributes. + ignore_attribute = '_ignore' + # The ignore attribute should be a string that references the + # attribute on a custom class object which holds strings and / or + # references of the attributes the class translator should ignore. + classes = LocalClasses() + # The list of classes to use for jsonclass translation. + version = 2.0 + # Version of the JSON-RPC spec to support + user_agent = 'jsonrpclib/0.1 (Python %s)' % \ + '.'.join([str(ver) for ver in sys.version_info[0:3]]) + # User agent to use for calls. + _instance = None + + @classmethod + def instance(cls): + if not cls._instance: + cls._instance = cls() + return cls._instance |