003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/serializers
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
serializers
/
📁
..
📄
__init__.py
(723 B)
📁
__pycache__
📄
configparser.py
(2.42 KB)
📄
json.py
(1.65 KB)
📄
msgpack.py
(3.34 KB)
📄
plist.py
(2.07 KB)
📄
python.py
(973 B)
📄
toml.py
(1.43 KB)
📄
yaml.py
(4.89 KB)
📄
yamlex.py
(12.63 KB)
Editing: python.py
""" salt.serializers.python ~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2016.3.0 Implements a Python serializer (via pprint.format) """ import pprint import salt.utils.json try: import simplejson as _json except ImportError: import json as _json # pylint: disable=blacklisted-import __all__ = ["serialize", "available"] available = True def serialize(obj, **options): """ Serialize Python data to a Python string representation (via pprint.format) :param obj: the data structure to serialize :param options: options given to pprint.format """ # round-trip this through JSON to avoid OrderedDict types # there's probably a more performant way to do this... # TODO remove json round-trip when all dataset will use # serializers return pprint.pformat( salt.utils.json.loads( salt.utils.json.dumps(obj, _json_module=_json), _json_module=_json ), **options )
Upload File
Create Folder