Hacked By AnonymousFox

Current Path : /opt/alt/python33/lib64/python3.3/json/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/json/__pycache__/encoder.cpython-33.pyc

�
��f�;c@s�dZddlZyddlmZWnek
r@dZYnXyddlmZWnek
rodZYnXej	d�Z
ej	d�Zej	d�Zidd	6d
d6dd
6dd6dd6dd6dd6Z
x3ed�D]%Ze
jee�dje��q�Wed�ZeZdd�Zdd�Zep=eZGdd�de�Zeeeeeee e!e"dd �	Z#dS(!uImplementation of JSONEncoder
iN(uencode_basestring_ascii(umake_encoderu[\x00-\x1f\\"\b\f\n\r\t]u([\\"]|[^\ -~])s[�-�]u\\u\u\"u"u\buu\fuu\nu
u\ru
u\tu	i u	\u{0:04x}uinfcCs$dd�}dtj||�dS(u5Return a JSON representation of a Python string

    cSst|jd�S(Ni(u
ESCAPE_DCTugroup(umatch((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyureplace%su"encode_basestring.<locals>.replaceu"(uESCAPEusub(usureplace((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyuencode_basestring!suencode_basestringcCs$dd�}dtj||�dS(uAReturn an ASCII-only JSON representation of a Python string

    cSs�|jd�}yt|SWnqtk
r�t|�}|dkrPdj|�S|d8}d|d?d@B}d|d@B}dj||�SYnXdS(	Niiu	\u{0:04x}i�i
i�i�u\u{0:04x}\u{1:04x}(ugroupu
ESCAPE_DCTuKeyErroruorduformat(umatchusunus1us2((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyureplace.s


u+py_encode_basestring_ascii.<locals>.replaceu"(uESCAPE_ASCIIusub(usureplace((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyupy_encode_basestring_ascii*supy_encode_basestring_asciic
Bsq|EeZdZdZdZdZd
dddd
ddddd�Z	dd�Z
dd	�Zd
d
d�ZdS(uJSONEncoderuZExtensible 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               | string        |
    +-------------------+---------------+
    | int, 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``).

    u, u: c		Css||_||_||_||_||_||_|dk	rW|\|_|_n|dk	ro||_	ndS(uHConstructor for JSONEncoder, with sensible defaults.

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

        If ensure_ascii is true, the output is guaranteed to be str
        objects with all incoming non-ASCII characters escaped.  If
        ensure_ascii is false, the output can contain non-ASCII characters.

        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``.

        N(
uskipkeysuensure_asciiucheck_circularu	allow_nanu	sort_keysuindentuNoneuitem_separatoru
key_separatorudefault(	uselfuskipkeysuensure_asciiucheck_circularu	allow_nanu	sort_keysuindentu
separatorsudefault((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu__init__bs-						uJSONEncoder.__init__cCstt|�d��dS(ulImplement 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)

        u is not JSON serializableN(u	TypeErrorurepr(uselfuo((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyudefault�suJSONEncoder.defaultcCsut|t�r/|jr"t|�St|�Sn|j|dd�}t|ttf�sht|�}ndj	|�S(u�Return a JSON string representation of a Python data structure.

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

        u	_one_shotuT(
u
isinstanceustruensure_asciiuencode_basestring_asciiuencode_basestringu
iterencodeuTrueulistutupleujoin(uselfuouchunks((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyuencode�s	

uJSONEncoder.encodec
Cs�|jri}nd}|jr*t}nt}|jtttdd�}|r�tdk	r�|j	dkr�t||j
||j	|j|j|j
|j|j�	}n9t||j
||j	||j|j|j
|j|�
}||d�S(u�Encode the given object and yield each string
        representation as available.

        For example::

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

        cSsl||krd}n4||kr*d}n||kr?d}n
||�S|shtdt|���n|S(NuNaNuInfinityu	-Infinityu2Out of range float values are not JSON compliant: (u
ValueErrorurepr(uou	allow_nanu_repru_infu_neginfutext((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyufloatstr�s			
u(JSONEncoder.iterencode.<locals>.floatstriN(ucheck_circularuNoneuensure_asciiuencode_basestring_asciiuencode_basestringu	allow_nanu
FLOAT_REPRuINFINITYuc_make_encoderuindentudefaultu
key_separatoruitem_separatoru	sort_keysuskipkeysu_make_iterencode(uselfuou	_one_shotumarkersu_encoderufloatstru_iterencode((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu
iterencode�s&
				uJSONEncoder.iterencodeNFT(
u__name__u
__module__u__qualname__u__doc__uitem_separatoru
key_separatoruFalseuTrueuNoneu__init__udefaultuencodeu
iterencode(u
__locals__((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyuJSONEncoderCs	6uJSONEncodercs��dk	r)����r)d��n����������
�������fdd�����������	�
���
�������fdd�����������
�������fdd���S(Nu c
3s*|sdVdS�dk	rO�
|�}|�krB�d��n|�|<nd}�dk	r�|d7}d�|}�|}||7}nd}�}d
}x@|D]8}|r�d}n|}�|��r�|�|�Vq�|dkr�|dVq�|d
kr|dVq�|dkr-|dVq��|��rN|�|�Vq��|�	�ro|�|�Vq�|V�|�
�f�r��||�}n0�|��r��||�}n�||�}x|D]}	|	Vq�Wq�W|dk	r|d8}d�|Vnd	V�dk	r&�|=ndS(Nu[]uCircular reference detectedu[iu
unullutrueufalseu]TF(uNoneuTrueuFalse(
ulstu_current_indent_levelumarkeridubufunewline_indentu	separatorufirstuvalueuchunksuchunk(u
ValueErroru_encoderu	_floatstru_indentu_item_separatoru_iterencodeu_iterencode_dictu_iterencode_listudictufloatuiduintu
isinstanceulistumarkersustrutuple(u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_iterencode_lists^




	


u*_make_iterencode.<locals>._iterencode_listc3s|sdVdS�dk	rO�
|�}|�krB�d��n|�|<ndV�dk	r�|d7}d�|}�|}|Vnd}�}d}�
r�t|j�ddd��}n|j�}x�|D]�\}}�|��r�n��|��r�|�}n�|dkr'd	}nn|dkr<d
}nY|dkrQd}nD�|��ro�|�}n&�	r{q�ntdt|�d
��|r�d}n|V�|�V�V�|��r��|�Vq�|dkr�dVq�|dkr�d	Vq�|dkrd
Vq��|��r/�|�Vq��|��rL�|�Vq��|��f�rs�||�}	n0�|��r��||�}	n�||�}	x|	D]}
|
Vq�Wq�W|dk	r�|d8}d�|VndV�dk	r��|=ndS(Nu{}uCircular reference detectedu{iu
ukeycSs|dS(Ni((ukv((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu<lambda>Usu<_make_iterencode.<locals>._iterencode_dict.<locals>.<lambda>utrueufalseunullukey u is not a stringu}TF(uNoneuTrueusorteduitemsuFalseu	TypeErrorurepr(udctu_current_indent_levelumarkeridunewline_indentuitem_separatorufirstuitemsukeyuvalueuchunksuchunk(u
ValueErroru_encoderu	_floatstru_indentu_item_separatoru_iterencodeu_iterencode_dictu_iterencode_listu_key_separatoru	_skipkeysu
_sort_keysudictufloatuiduintu
isinstanceulistumarkersustrutuple(u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_iterencode_dictAs�


!				


u*_make_iterencode.<locals>._iterencode_dictc3s��|��r�|�Vn_|dkr1dVnK|dkrEdVn7|dkrYdVn#�|�
�rv�|�Vn�|��r��|�Vn��|��f�r�x��||�D]}|Vq�Wn��|��r�x��||�D]}|Vq�Wn��
dk	r;�	|�}|�
kr.�d��n|�
|<n�|�}x�||�D]}|VqWW�
dk	r|�
|=ndS(NunullutrueufalseuCircular reference detectedTF(uNoneuTrueuFalse(uou_current_indent_leveluchunkumarkerid(u
ValueErroru_defaultu_encoderu	_floatstru_iterencodeu_iterencode_dictu_iterencode_listudictufloatuiduintu
isinstanceulistumarkersustrutuple(u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_iterencode�s8
	u%_make_iterencode.<locals>._iterencode(uNone(umarkersu_defaultu_encoderu_indentu	_floatstru_key_separatoru_item_separatoru
_sort_keysu	_skipkeysu	_one_shotu
ValueErrorudictufloatuiduintu
isinstanceulistustrutuple((u
ValueErroru_defaultu_encoderu	_floatstru_indentu_item_separatoru_iterencodeu_iterencode_dictu_iterencode_listu_key_separatoru	_skipkeysu
_sort_keysudictufloatuiduintu
isinstanceulistumarkersustrutupleu1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_make_iterencode�s
B5KL?u_make_iterencode($u__doc__ureu_jsonuencode_basestring_asciiuc_encode_basestring_asciiuImportErroruNoneumake_encoderuc_make_encoderucompileuESCAPEuESCAPE_ASCIIuHAS_UTF8u
ESCAPE_DCTurangeuiu
setdefaultuchruformatufloatuINFINITYurepru
FLOAT_REPRuencode_basestringupy_encode_basestring_asciiuobjectuJSONEncoderu
ValueErrorudictuiduintu
isinstanceulistustrutupleu_make_iterencode(((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu<module>sJ


#	�

Hacked By AnonymousFox1.0, Coded By AnonymousFox