AlkantarClanX12

Your IP : 3.138.36.168


Current Path : /proc/self/root/lib64/python2.7/json/
Upload File :
Current File : //proc/self/root/lib64/python2.7/json/encoder.pyo

�
{fc@sdZddlZyddlmZWnek
r?dZnXyddlmZWnek
rmdZnXej	d�Z
ej	d�Zej	d�Zidd	6d
d6dd
6dd6dd6dd6dd6Z
x3ed�D]%Ze
jee�dje��q�Wed�ZejZd�Zd�Zep8eZdefd��YZeeeeeee e!e"e#e$d�Z%dS(sImplementation of JSONEncoder
i����N(tencode_basestring_ascii(tmake_encoders[\x00-\x1f\\"\b\f\n\r\t]s([\\"]|[^\ -~])s[\x80-\xff]s\\s\s\"t"s\bss\fss\ns
s\rs
s\ts	i s	\u{0:04x}tinfcCs!d�}dtj||�dS(s5Return a JSON representation of a Python string

    cSst|jd�S(Ni(t
ESCAPE_DCTtgroup(tmatch((s$/usr/lib64/python2.7/json/encoder.pytreplace%sR(tESCAPEtsub(tsR((s$/usr/lib64/python2.7/json/encoder.pytencode_basestring!s	cCs]t|t�r6tj|�dk	r6|jd�}nd�}dttj||��dS(sAReturn an ASCII-only JSON representation of a Python string

    sutf-8cSs�|jd�}yt|SWnptk
r�t|�}|dkrPdj|�S|d8}d|d?d@B}d|d@B}dj||�SnXdS(	Niis	\u{0:04x}i�i
i�i�s\u{0:04x}\u{1:04x}(RRtKeyErrortordtformat(RR
tnts1ts2((s$/usr/lib64/python2.7/json/encoder.pyR0s


RN(t
isinstancetstrtHAS_UTF8tsearchtNonetdecodetESCAPE_ASCIIR	(R
R((s$/usr/lib64/python2.7/json/encoder.pytpy_encode_basestring_ascii*s$	tJSONEncoderc
Bs\eZdZdZdZeeeeeddddd�	Zd�Z	d�Z
ed�ZRS(	sZExtensible JSON <http://json.org> encoder for Python data structures.

    Supports the following objects and types by default:

    +-------------------+---------------+
    | Python            | JSON          |
    +===================+===============+
    | dict              | object        |
    +-------------------+---------------+
    | list, tuple       | array         |
    +-------------------+---------------+
    | str, unicode      | string        |
    +-------------------+---------------+
    | int, long, float  | number        |
    +-------------------+---------------+
    | True              | true          |
    +-------------------+---------------+
    | False             | false         |
    +-------------------+---------------+
    | None              | null          |
    +-------------------+---------------+

    To extend this to recognize other objects, subclass and implement a
    ``.default()`` method with another method that returns a serializable
    object for ``o`` if possible, otherwise it should call the superclass
    implementation (to raise ``TypeError``).

    s, s: sutf-8c

Cs|||_||_||_||_||_||_|dk	rW|\|_|_n|	dk	ro|	|_	n||_
dS(s�	Constructor for JSONEncoder, with sensible defaults.

        If skipkeys is false, then it is a TypeError to attempt
        encoding of keys that are not str, int, long, float or None.  If
        skipkeys is True, such items are simply skipped.

        If *ensure_ascii* is true (the default), all non-ASCII
        characters in the output are escaped with \uXXXX sequences,
        and the results are str instances consisting of ASCII
        characters only.  If ensure_ascii is False, a result may be a
        unicode instance.  This usually happens if the input contains
        unicode strings or the *encoding* parameter is used.

        If check_circular is true, then lists, dicts, and custom encoded
        objects will be checked for circular references during encoding to
        prevent an infinite recursion (which would cause an OverflowError).
        Otherwise, no such check takes place.

        If allow_nan is true, then NaN, Infinity, and -Infinity will be
        encoded as such.  This behavior is not JSON specification compliant,
        but is consistent with most JavaScript based encoders and decoders.
        Otherwise, it will be a ValueError to encode such floats.

        If sort_keys is true, then the output of dictionaries will be
        sorted by key; this is useful for regression tests to ensure
        that JSON serializations can be compared on a day-to-day basis.

        If indent is a non-negative integer, then JSON array
        elements and object members will be pretty-printed with that
        indent level.  An indent level of 0 will only insert newlines.
        None is the most compact representation.  Since the default
        item separator is ', ',  the output might include trailing
        whitespace when indent is specified.  You can use
        separators=(',', ': ') to avoid this.

        If specified, separators should be a (item_separator, key_separator)
        tuple.  The default is (', ', ': ').  To get the most compact JSON
        representation you should specify (',', ':') to eliminate whitespace.

        If specified, default is a function that gets called for objects
        that can't otherwise be serialized.  It should return a JSON encodable
        version of the object or raise a ``TypeError``.

        If encoding is not None, then all input strings will be
        transformed into unicode using that encoding prior to JSON-encoding.
        The default is UTF-8.

        N(tskipkeystensure_asciitcheck_circulart	allow_nant	sort_keystindentRtitem_separatort
key_separatortdefaulttencoding(
tselfRRRRRR t
separatorsR$R#((s$/usr/lib64/python2.7/json/encoder.pyt__init__es4						cCstt|�d��dS(slImplement this method in a subclass such that it returns
        a serializable object for ``o``, or calls the base implementation
        (to raise a ``TypeError``).

        For example, to support arbitrary iterators, you could
        implement default like this::

            def default(self, o):
                try:
                    iterable = iter(o)
                except TypeError:
                    pass
                else:
                    return list(iterable)
                # Let the base class default method raise the TypeError
                return JSONEncoder.default(self, o)

        s is not JSON serializableN(t	TypeErrortrepr(R%to((s$/usr/lib64/python2.7/json/encoder.pyR#�scCs�t|t�rut|t�rU|j}|dk	rU|dkrU|j|�}qUn|jrht|�St|�Sn|j	|dt
�}t|ttf�s�t|�}ndj
|�S(s�Return a JSON string representation of a Python data structure.

        >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
        '{"foo": ["bar", "baz"]}'

        sutf-8t	_one_shottN(Rt
basestringRR$RRRRRt
iterencodetTruetlistttupletjoin(R%R*t	_encodingtchunks((s$/usr/lib64/python2.7/json/encoder.pytencode�s	
	

cCs|jri}nd}|jr*t}nt}|jdkrT||jd�}n|jtttd�}|r�t	dk	r�|j
dkr�|jr�t	||j||j
|j
|j|j|j|j�	}n9t||j||j
||j
|j|j|j|�
}||d�S(s�Encode the given object and yield each string
        representation as available.

        For example::

            for chunk in JSONEncoder().iterencode(bigobject):
                mysocket.write(chunk)

        sutf-8cSs+t|t�r!|j|�}n||�S(N(RRR(R*t
_orig_encoderR3((s$/usr/lib64/python2.7/json/encoder.pyt_encoder�scSsl||krd}n4||kr*d}n||kr?d}n
||�S|shtdt|���n|S(NtNaNtInfinitys	-Infinitys2Out of range float values are not JSON compliant: (t
ValueErrorR)(R*Rt_reprt_inft_neginfttext((s$/usr/lib64/python2.7/json/encoder.pytfloatstr�s			
iN(RRRRRR$Rt
FLOAT_REPRtINFINITYtc_make_encoderR RR#R"R!Rt_make_iterencode(R%R*R+tmarkersR7R?t_iterencode((s$/usr/lib64/python2.7/json/encoder.pyR.�s*
				N(t__name__t
__module__t__doc__R!R"tFalseR/RR'R#R5R.(((s$/usr/lib64/python2.7/json/encoder.pyRFs	>		cs�����������
���������fd�����������	�
���
���������fd�����������
���������fd���S(Nc
3s8|sdVdS�dk	rO�|�}|�krB�d��n|�|<nd}�dk	r�|d7}dd�|}�|}||7}nd}�}t}xF|D]>}|r�t}n|}�
|��r�|�|�Vq�|dkr|dVq�|tkr|dVq�|tkr1|d	Vq��
|��f�rX|�|�Vq��
|�
�ry|�|�Vq�|V�
|��f�r��||�}n0�
|�	�r��||�}n�||�}x|D]}	|	Vq�Wq�W|dk	r|d8}dd�|Vnd
V�dk	r4�|=ndS(Ns[]sCircular reference detectedt[is
t tnullttruetfalset](RR/RI(
tlstt_current_indent_leveltmarkeridtbuftnewline_indentt	separatortfirsttvalueR4tchunk(R:R7t	_floatstrt_indentt_item_separatorREt_iterencode_dictt_iterencode_listR-tdicttfloattidtintRR0tlongRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR] s^




	


c3s|sdVdS�dk	rO�|�}|�krB�d��n|�|<ndV�dk	r�|d7}dd�|}�|}|Vnd}�}t}�
r�t|j�dd��}n|j�}x�|D]�\}}�|��r�n��|�
�r�|�}n�|tkr(d	}nt|tkr=d
}n_|dkrRd}nJ�|��f�rv�|�}n&�	r�q�ntdt|�d
��|r�t}n|V�|�V�V�|��r��|�Vq�|dkr�dVq�|tkrd	Vq�|tkrd
Vq��|��f�r<�|�Vq��|�
�rY�|�Vq��|��f�r��||�}	n0�|��r��||�}	n�||�}	x|	D]}
|
Vq�Wq�W|dk	r�|d8}dd�|VndV�dk	r�|=ndS(Ns{}sCircular reference detectedt{is
RKtkeycSs|dS(Ni((tkv((s$/usr/lib64/python2.7/json/encoder.pyt<lambda>iR,RMRNRLskey s is not a stringt}(RR/tsortedtitemst	iteritemsRIR(R)(tdctRQRRRTR!RVRiRdRWR4RX(R:R7RYRZR[RER\R]t_key_separatort	_skipkeyst
_sort_keysR-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR\Us�


				


c3s��|��r�|�Vne|dkr1dVnQ|tkrEdVn=|tkrYdVn)�|��f�r|�|�Vn�|�	�r��|�Vn��|�
�f�r�x��||�D]}|Vq�Wn��|��rx��||�D]}|Vq�Wn��dk	rA�
|�}|�kr4�d��n|�|<n�|�}x�||�D]}|Vq]W�dk	r��|=ndS(NRLRMRNsCircular reference detected(RR/RI(R*RQRXRR(R:t_defaultR7RYRER\R]R-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyRE�s8
	((RDRoR7RZRYRlR[RnRmR+R:R-R^R_R`RaRR0RbRR1((R:RoR7RYRZR[RER\R]RlRmRnR-R^R_R`RaRR0RbRDRR1s$/usr/lib64/python2.7/json/encoder.pyRCsE5NLB(&RHtret_jsonRtc_encode_basestring_asciitImportErrorRRRBtcompileRRRRtrangetit
setdefaulttchrRR_RAt__repr__R@RRtobjectRR:R-R^R`RaRR0RbRR1RC(((s$/usr/lib64/python2.7/json/encoder.pyt<module>sN




#				�