/usr/lib/python2.7/dist-packages/PyTango/codec.py is in python-pytango 8.1.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | __all__ = ["loads", "dumps"]
def loads(fmt, data):
if fmt.startswith("pickle"):
import pickle
loads = pickle.loads
elif fmt.startswith("json"):
import json
loads = json.loads
else:
raise TypeError("Format '{0}' not supported".format(fmt))
return loads(data)
def dumps(fmt, obj):
if fmt.startswith("pickle"):
import pickle
ret = fmt, pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)
return ret
elif fmt.startswith("json"):
import json
return fmt, json.dumps(obj)
raise TypeError("Format '{0}' not supported".format(fmt))
|