%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/json.pyc

�
���^c@@s�dZddlmZmZddlZddlZddlZddlZddl	m
Z
eje�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zd�ZdS(u
Functions to work with JSON
i(tabsolute_importtunicode_literalsN(tsixcC@s
|j�S(u�
    Performs a splitlines on the string. This function exists to make mocking
    possible in unit tests, since the member functions of the str/unicode
    builtins cannot be mocked.
    (t
splitlines(traw((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyt__splitscC@s�i}t|�}x�t|�D]�\}}ydj||�}Wn3tk
rwdjtjjj||��}nXytj	|�}Wnt
k
r�qnX|r|SqW|s�t
�ndS(u�
    Pass in a raw string and load the json when it starts. This allows for a
    string to start with garbage and end with json but be cleanly loaded
    u
N(Rt	enumeratetjointUnicodeDecodeErrortsalttutilstdatatdecodetjsontloadst
ValueError(Rtrettlinestindt_tworking((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyt	find_jsons
&
cC@sPxIdD]A}y$t|�}tjd|�|SWqtk
rGqqXqWdS(uU
    Import a json module, starting with the quick ones and going down the list)
    uujsonuyajlujsonuloaded %s json libN(uujsonuyajlujson(t
__import__tlogttracetImportError(t	fast_jsontmod((s3/usr/lib/python2.7/site-packages/salt/utils/json.pytimport_json7s

cK@s|jdt�j||�S(u�
    .. versionadded:: 2018.3.0

    Wraps json.load

    You can pass an alternate json module (loaded via import_json() above)
    using the _json_module argument)
    u_json_module(tpopR
tload(tfptkwargs((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyRDs	cK@s}|jdt�}y|j||�SWnPtk
rx}tjrot|t�ro|jtj	j
j|�|�S|�nXdS(u)
    .. versionadded:: 2018.3.0

    Wraps json.loads and prevents a traceback in the event that a bytestring is
    passed to the function. (Python < 3.6 cannot load bytestrings)

    You can pass an alternate json module (loaded via import_json() above)
    using the _json_module argument)
    u_json_moduleN(RR
Rt	TypeErrorRtPY3t
isinstancetbytesR	R
tstringutilst
to_unicode(tsR tjson_moduletexc((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyRPs
cK@s_|jdt�}d|kr+t|d<ntjrLtjjj|�}n|j	|||�S(u

    .. versionadded:: 2018.3.0

    Wraps json.dump, and assumes that ensure_ascii is False (unless explicitly
    passed as True) for unicode compatibility. Note that setting it to True
    will mess up any unicode characters, as they will be dumped as the string
    literal version of the unicode code point.

    On Python 2, encodes the result to a str since json.dump does not want
    unicode types.

    You can pass an alternate json module (loaded via import_json() above)
    using the _json_module argument)
    u_json_moduleuensure_ascii(
RR
tFalseRtPY2R	R
Rtencodetdump(tobjRR R(((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyR-es
	cK@shddl}|jdt�}d|kr7t|d<ntjrXtjjj	|�}n|j
||�S(u
    .. versionadded:: 2018.3.0

    Wraps json.dumps, and assumes that ensure_ascii is False (unless explicitly
    passed as True) for unicode compatibility. Note that setting it to True
    will mess up any unicode characters, as they will be dumped as the string
    literal version of the unicode code point.

    On Python 2, encodes the result to a str since json.dumps does not want
    unicode types.

    You can pass an alternate json module (loaded via import_json() above)
    using the _json_module argument)
    iNu_json_moduleuensure_ascii(tsysRR
R*RR+R	R
RR,tdumps(R.R R/R(((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyR0|s
	(t__doc__t
__future__RRR
tloggingtsalt.utils.dataR	tsalt.utils.stringutilstsalt.extRt	getLoggert__name__RRRRRRR-R0(((s3/usr/lib/python2.7/site-packages/salt/utils/json.pyt<module>s				
			

Zerion Mini Shell 1.0