Ñò
#8Zc           @   sS  d  Z  d d k Z d d k Z d d k l Z l Z y d d k l Z Wn e	 j
 o d Z n Xd g Z e i e i Be i BZ e d ƒ e d ƒ e d ƒ Z Z Z d	 „  Z d d
 „ Z h e d 6e d 6e d 6e d 6e d 6d d 6Z e d „ Z e d ƒ e ƒ d „  Z e d ƒ e ƒ e i d e ƒ Z h d d 6d d 6d d 6d d 6d d 6d  d! 6d" d# 6d$ d% 6Z d& Z d e e e i d' „ Z  e d j	 o
 e Z n e  Z d( „  Z! e d ƒ e! ƒ e i d) e ƒ Z" e" i d* „ Z# e d+ ƒ e# ƒ e" i d, „ Z$ e d- ƒ e$ ƒ e# e$ e! e e g Z% e e% ƒ Z& d e' f d. „  ƒ  YZ( d S(/   s   Implementation of JSONDecoder
iÿÿÿÿN(   t   Scannert   pattern(   t
   scanstringt   JSONDecodert   nant   infs   -infc         C   sS   |  i  d d | ƒ d } | d j o
 | } n | |  i d d | ƒ } | | f S(   Ns   
i    i   (   t   countt   rindex(   t   doct   post   linenot   colno(    (    s"   /usr/lib/python2.6/json/decoder.pyt   linecol   s
    
c   	      C   sy   t  | | ƒ \ } } | d  j o d } | i |  | | | ƒ St  | | ƒ \ } } d } | i |  | | | | | | ƒ S(   Ns#   {0}: line {1} column {2} (char {3})s?   {0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(   R   t   Nonet   format(	   t   msgR   R	   t   endR
   R   t   fmtt	   endlinenot   endcolno(    (    s"   /usr/lib/python2.6/json/decoder.pyt   errmsg   s    s	   -Infinityt   Infinityt   NaNt   truet   falset   nullc         C   sR   |  i  d ƒ } t | d d  ƒ } | d  j o | | } n | | ƒ } | d  f S(   Ni    t   parse_constant(   t   groupt   getattrR   (   t   matcht   contextt   ct   st   fnt   rval(    (    s"   /usr/lib/python2.6/json/decoder.pyt   JSONConstant1   s    s    (-?Infinity|NaN|true|false|null)c         C   s¯   t  i i |  i |  i ƒ  Œ }  |  i ƒ  \ } } } | p | o? t | d d  ƒ p t } | | | p d | p d ƒ } n& t | d d  ƒ p t	 } | | ƒ } | d  f S(   Nt   parse_floatt    t	   parse_int(
   t
   JSONNumbert   regexR   t   stringt   spant   groupsR   R   t   floatt   int(   R   R   t   integert   fract   expR!   t   res(    (    s"   /usr/lib/python2.6/json/decoder.pyR'   <   s    &s)   (-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?s   (.*?)(["\\\x00-\x1f])u   "t   "u   \s   \u   /t   /u   t   bu   t   fu   
t   nu   t   ru   	t   ts   utf-8c         C   s=  | d  j o
 t } n g  } | i } | d } x÷| |  | ƒ }	 |	 d  j o t t d |  | ƒ ƒ ‚ n |	 i ƒ  } |	 i ƒ  \ }
 } |
 o1 t |
 t ƒ p t |
 | ƒ }
 n | |
 ƒ n | d j o PnQ | d j oC | o+ d i	 | ƒ } t t | |  | ƒ ƒ ‚ q#| | ƒ q3 n y |  | } Wn+ t
 j
 o t t d |  | ƒ ƒ ‚ n X| d j oY y | | } Wn: t j
 o. d i	 | ƒ } t t | |  | ƒ ƒ ‚ n X| d 7} nY|  | d | d !} | d } d	 } yÿ t | ƒ d
 j o
 t ‚ n t | d ƒ } d | j o
 d j n o¥ t i d j o• d } |  | d | d !d j p
 t ‚ n |  | d | d !} t | ƒ d
 j o
 t ‚ n t | d ƒ } d | d d >| d B} | d 7} n t | ƒ } Wn+ t j
 o t t | |  | ƒ ƒ ‚ n X| } | | ƒ q3 d i | ƒ | f S(   Ni   s   Unterminated string starting atR2   s   \s"   Invalid control character {0!r} att   us   Invalid \escape: {0!r}i   s   Invalid \uXXXX escapei   i   i Ø  iÿÛ  iÿÿ  s#   Invalid \uXXXX\uXXXX surrogate pairi   s   \ui   i   i
   i Ü  i   u    (   R   t   DEFAULT_ENCODINGt   appendt
   ValueErrorR   R   R+   t
   isinstancet   unicodeR   t
   IndexErrort   KeyErrort   lenR-   t   syst
   maxunicodet   unichrt   join(   R    R   t   encodingt   strictt   _bt   _mt   chunkst   _appendt   begint   chunkt   contentt
   terminatorR   t   esct   mt   next_endt   unit   esc2t   uni2(    (    s"   /usr/lib/python2.6/json/decoder.pyt   py_scanstringR   sv    
	



.

c         C   s@   t  | d d  ƒ } t  | d t ƒ } t |  i |  i ƒ  | | ƒ S(   NRF   RG   (   R   R   t   TrueR   R)   R   (   R   R   RF   RG   (    (    s"   /usr/lib/python2.6/json/decoder.pyt
   JSONString˜   s    s   \s*c         C   s¨  h  } |  i  } | | |  i ƒ  ƒ i ƒ  } | | | d !} | d j o | | d f S| d j o t t d | | ƒ ƒ ‚ n | d 7} t | d d  ƒ } t | d t ƒ } t i }	 xµt o­t	 | | | | ƒ \ }
 } | | | ƒ i ƒ  } | | | d !d j o t t d | | ƒ ƒ ‚ n | | | d ƒ i ƒ  } y( |	 | d	 | d
 | ƒi
 ƒ  \ } } Wn+ t j
 o t t d | | ƒ ƒ ‚ n X| | |
 <| | | ƒ i ƒ  } | | | d !} | d 7} | d j o Pn | d j o  t t d | | d ƒ ƒ ‚ n | | | ƒ i ƒ  } | | | d !} | d 7} | d j o  t t d | | d ƒ ƒ ‚ qº qº Wt | d d  ƒ } | d  j	 o | | ƒ } n | | f S(   Ni   t   }R2   s   Expecting property nameRF   RG   t   :s   Expecting : delimitert   idxR   s   Expecting objectt   ,s   Expecting , delimitert   object_hook(   R)   R   R<   R   R   R   RW   t   JSONScannert   iterscanR   t   nextt   StopIteration(   R   R   t   _wt   pairsR    R   t   nextcharRF   RG   R_   t   keyt   valueR]   (    (    s"   /usr/lib/python2.6/json/decoder.pyt
   JSONObject¢   sP    	
	 (

 
%t   {c   	   
   C   s\  g  } |  i  } | | |  i ƒ  ƒ i ƒ  } | | | d !} | d j o | | d f St i } xï t oç y( | | d | d | ƒi ƒ  \ } } Wn+ t j
 o t t d | | ƒ ƒ ‚ n X| i	 | ƒ | | | ƒ i ƒ  } | | | d !} | d 7} | d j o Pn | d j o t t d | | ƒ ƒ ‚ n | | | ƒ i ƒ  } qc W| | f S(   Ni   t   ]R[   R   s   Expecting objectR\   s   Expecting , delimiter(
   R)   R   R^   R_   RW   R`   Ra   R<   R   R;   (	   R   R   Rb   t   valuesR    R   Rd   R_   Rf   (    (    s"   /usr/lib/python2.6/json/decoder.pyt	   JSONArrayÎ   s.    		 (
s   \[c           B   s\   e  Z d  Z e e ƒ Z d d d g Z d d d d d e d „ Z	 e
 i d „ Z d „  Z RS(   s  Simple JSON <http://json.org> decoder

    Performs the following translations in decoding by default:

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

    It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
    their corresponding ``float`` values, which is outside the JSON spec.
    t   __init__t   decodet
   raw_decodec         C   s:   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ d S(   sy  ``encoding`` determines the encoding used to interpret any ``str``
        objects decoded by this instance (utf-8 by default).  It has no
        effect when decoding ``unicode`` objects.

        Note that currently only encodings that are a superset of ASCII work,
        strings of other encodings should be passed in as ``unicode``.

        ``object_hook``, if specified, will be called with the result of
        every JSON object decoded and its return value will be used in
        place of the given ``dict``.  This can be used to provide custom
        deserializations (e.g. to support JSON-RPC class hinting).

        ``parse_float``, if specified, will be called with the string
        of every JSON float to be decoded. By default this is equivalent to
        float(num_str). This can be used to use another datatype or parser
        for JSON floats (e.g. decimal.Decimal).

        ``parse_int``, if specified, will be called with the string
        of every JSON int to be decoded. By default this is equivalent to
        int(num_str). This can be used to use another datatype or parser
        for JSON integers (e.g. float).

        ``parse_constant``, if specified, will be called with one of the
        following strings: -Infinity, Infinity, NaN, null, true, false.
        This can be used to raise an exception if invalid JSON numbers
        are encountered.

        N(   RF   R]   R$   R&   R   RG   (   t   selfRF   R]   R$   R&   R   RG   (    (    s"   /usr/lib/python2.6/json/decoder.pyRl     s    					c         C   s{   |  i  | d | | d ƒ i ƒ  ƒ\ } } | | | ƒ i ƒ  } | t | ƒ j o% t t d | | t | ƒ ƒ ƒ ‚ n | S(   sƒ   
        Return the Python representation of ``s`` (a ``str`` or ``unicode``
        instance containing a JSON document)

        R[   i    s
   Extra data(   Rn   R   RA   R<   R   (   Ro   R    Rb   t   objR   (    (    s"   /usr/lib/python2.6/json/decoder.pyRm   9  s
    *%c         K   sa   | i  d |  ƒ y% |  i i | |  i ƒ  \ } } Wn t j
 o t d ƒ ‚ n X| | f S(   sL  Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning
        with a JSON document) and return a 2-tuple of the Python
        representation and the index in ``s`` where the document ended.

        This can be used to decode a JSON document from a string that may
        have extraneous data at the end.

        R   s   No JSON object could be decoded(   t
   setdefaultt   _scannerR_   R`   Ra   R<   (   Ro   R    t   kwRp   R   (    (    s"   /usr/lib/python2.6/json/decoder.pyRn   E  s    	%N(   t   __name__t
   __module__t   __doc__R    t   ANYTHINGRr   t   __all__R   RW   Rl   t
   WHITESPACER   Rm   Rn   (    (    (    s"   /usr/lib/python2.6/json/decoder.pyR   ô   s   	$()   Rv   t   reRB   t   json.scannerR    R   t   _jsonR   t   c_scanstringt   ImportErrorR   Rx   t   VERBOSEt	   MULTILINEt   DOTALLt   FLAGSR,   R   t   PosInft   NegInfR   R   RW   t   Falset
   _CONSTANTSR#   R'   t   compilet   STRINGCHUNKt	   BACKSLASHR:   R   RV   RX   Ry   Rg   Rk   Rw   R^   t   objectR   (    (    (    s"   /usr/lib/python2.6/json/decoder.pyt   <module>   s\   	&		

	
&A
	)	