m
fIc        	   @   s  d  Z  d Z d k Td k l Z d k l Z l Z l Z d k Z d k	 Z	 d k
 Z
 d k Z d k Z d d d d	 d
 d d d d g	 Z d Z d d d d d g Z d Z e i Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ y d k l Z Wn e j
 o e Z n Xy e Wn e j
 o e Z n Xd Z d Z d Z  d Z! d Z" d  Z# d! Z$ d" Z% d# Z& d$ Z' d% Z( d& Z) d' Z* d( Z+ d) Z, d* Z- d+ Z. d, Z/ d- Z0 d. Z1 d/ Z2 d0 Z3 d1 Z4 d2 Z5 d3 Z6 d4 Z7 d5 Z8 d6 Z9 d7 Z: d8 Z; d9 Z< d: Z= d; Z> d< Z? d= Z@ d> ZA d? ZB d@ ZC dA ZD dB ZE dC ZF dD ZG dE ZH dF ZI dG ZJ dH ZK dI ZL dJ ZM dK ZN dL ZO dM ZP dN ZQ dO ZR dP ZS dQ ZT eD eN eO eP g ZU e iV g  ZW eX   D]$ ZY e iZ dR eY  o eW eY n q[W  [Y d	 f  dS     YZ[ dT   Z\ h  Z] dU   Z^ d
 f  dV     YZ_ dW f  dX     YZ` d ka Zb dY   Zc dZ   Zd y d[ ke lf Zf Wn  e j
 o d[ kf lf Zf n Xe e d\  Zg e e d]  Zh d^   Zi d_   Z d`   Zj ek da j o ej   n d S(b   s  Create portable serialized representations of Python objects.

See module cPickle for a (much) faster implementation.
See module copy_reg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.

Classes:

    Pickler
    Unpickler

Functions:

    dump(object, file)
    dumps(object) -> string
    load(file) -> object
    loads(string) -> object

Misc variables:

    __version__
    format_version
    compatible_formats

s   $Revision: 36861 $(   t   *(   s   dispatch_table(   s   _extension_registrys   _inverted_registrys   _extension_cacheNt   PickleErrort   PicklingErrort   UnpicklingErrort   Picklert	   Unpicklert   dumpt   dumpst   loadt   loadss   2.0s   1.0s   1.1s   1.2s   1.3i   c           B   s   t  Z d  Z RS(   s6   A common base class for the other pickling exceptions.(   t   __name__t
   __module__t   __doc__(    (    (    t#   /mit/python/lib/python2.4/pickle.pyR   ;   s   c           B   s   t  Z d  Z RS(   s]   This exception is raised when an unpicklable object is passed to the
    dump() method.

    (   R
   R   R   (    (    (    R   R   ?   s   c           B   s   t  Z d  Z RS(   s  This exception is raised when there is a problem unpickling an object,
    such as a security violation.

    Note that other exceptions may also be raised during unpickling, including
    (but not necessarily limited to) AttributeError, EOFError, ImportError,
    and IndexError.

    (   R
   R   R   (    (    (    R   R   F   s   t   _Stopc           B   s   t  Z d   Z RS(   Nc         C   s   | |  _  d  S(   N(   t   valuet   self(   R   R   (    (    R   t   __init__T   s    (   R
   R   R   (    (    (    R   R   S   s   (   s   PyStringMapt   (t   .t   0t   1t   2t   Ft   It   Jt   Kt   Lt   Mt   Nt   Pt   Qt   Rt   St   Tt   Ut   Vt   Xt   at   bt   ct   dt   }t   et   gt   ht   it   jt   lt   ]t   ot   pt   qt   rt   st   tt   )t   ut   Gs   I01
s   I00
s   s   s   s   s   s   s   s   s   s   s   s   s   [A-Z][A-Z0-9_]+$c           B   s  t  Z d  d  d  Z d   Z d   Z d   Z e i d  Z	 e i d  Z
 d   Z d   Z d	   Z d  d  d  d  d
  Z h  Z d   Z e e e <d   Z e e e <e i d  Z e e e <e i d  Z e e e <e i d  Z e e e <e i d  Z e e e <e i d  Z e e e <e e j o e i d  Z e e e <n d   Z e e e <d   Z  d   Z! e! e e" <d Z# d   Z$ d   Z% e% e e& <e' d  j	 o e% e e' <n d   Z( d   Z) e) e e* <d  e i d  Z+ e+ e e, <e+ e e- <e+ e e. <e+ e e/ <RS(   Nc         C   s   | d j	 o | d j	 o t d  n | d j	 o t i d t  | } n | d j o
 d } n | d j  o
 t } n3 d | j o
 t j n p t d t   n | i	 |  _	 h  |  _ t |  |  _ | d j |  _ d |  _ d S(   s8  This takes a file-like object for writing a pickle data stream.

        The optional protocol argument tells the pickler to use the
        given protocol; supported protocols are 0, 1, 2.  The default
        protocol is 0, to be backwards compatible.  (Protocol 0 is the
        only protocol that can be written to a file opened in text
        mode and read back successfully.  When using a protocol higher
        than 0, make sure the file is opened in binary mode, both when
        pickling and unpickling.)

        Protocol 1 is more efficient than protocol 0; protocol 2 is
        more efficient than protocol 1.

        Specifying a negative protocol version selects the highest
        protocol version supported.  The higher the protocol used, the
        more recent the version of Python needed to read the pickle
        produced.

        The file parameter must have a write() method that accepts a single
        string argument.  It can thus be an open file object, a StringIO
        object, or any other custom object that meets this interface.

        s'   can't specify both 'protocol' and 'bin's-   The 'bin' argument to Pickler() is deprecatedi    s   pickle protocol must be <= %di   N(   t   protocolt   Nonet   bint
   ValueErrort   warningst   warnt   DeprecationWarningt   HIGHEST_PROTOCOLt   filet   writeR   t   memot   intt   protot   fast(   R   RC   R;   R=   (    (    R   R      s$     	


	c         C   s   |  i i   d S(   s  Clears the pickler's "memo".

        The memo is the data structure that remembers which objects the
        pickler has already seen, so that shared or recursive objects are
        pickled by reference and not by value.  This method is useful when
        re-using picklers.

        N(   R   RE   t   clear(   R   (    (    R   t
   clear_memo   s     c         C   sL   |  i d j o |  i t t |  i   n |  i |  |  i t  d S(   s7   Write a pickled representation of obj to the open file.i   N(   R   RG   RD   t   PROTOt   chrt   savet   objt   STOP(   R   RN   (    (    R   R      s
     c         C   sq   |  i o d Sn t |  |  i j p t  t |  i  } |  i |  i	 |   | | f |  i t |  <d S(   s   Store an object in the memo.N(
   R   RH   t   idRN   RE   t   AssertionErrort   lent   memo_lenRD   t   put(   R   RN   RS   (    (    R   t   memoize   s     
c         C   sP   |  i o4 | d j  o t t |  Sq> t | d |  Sn t t |  d S(   Ni   s   <is   
(	   R   R=   R.   t   BINPUTRL   t   LONG_BINPUTt   packt   PUTt   repr(   R   R.   RX   (    (    R   RT     s
    
c         C   sP   |  i o4 | d j  o t t |  Sq> t | d |  Sn t t |  d S(   Ni   s   <is   
(	   R   R=   R.   t   BINGETRL   t   LONG_BINGETRX   t   GETRZ   (   R   R.   RX   (    (    R   t   get  s
    
c   
      C   s)  |  i |  } | o |  i |  d  Sn |  i i t |   }	 |	 o" |  i	 |  i |	 d   d  Sn t
 |  } |  i i |  } | o | |  |  d  Sn y t | t  } Wn t j
 o d } n X| o |  i |  d  Sn t i |  } | o | |  } nl t | d d   } | o | |  i  } n@ t | d d   } | o |   } n t d | i | f   t
 |  t j o |  i | |  d  Sn t
 |  t j	 o t d |   n t |  } d | j o
 d j n p t d |   n |  i d	 | |  d  S(
   Ni    t   __reduce_ex__t
   __reduce__s   Can't pickle %r object: %rs   %s must return string or tuplei   i   s3   Tuple returned by %s must have two to five elementsRN   (    R   t   persistent_idRN   t   pidt	   save_persRE   R^   RP   t   xRD   t   typeR7   t   dispatcht   ft
   issubclasst   TypeTypet   issct	   TypeErrort   save_globalt   dispatch_tablet   reducet   rvt   getattrR<   RG   R   R
   t
   StringTypet	   TupleTypeRR   R0   t   save_reduce(
   R   RN   Rn   Ro   Rb   Rj   Rg   R0   R7   Rd   (    (    R   RM     sN    c         C   s   d  S(   N(   R<   (   R   RN   (    (    R   Ra   T  s    c         C   sG   |  i o |  i |  |  i t  n |  i t t |  d  d  S(   Ns   
(   R   R=   RM   Rb   RD   t	   BINPERSIDt   PERSIDt   str(   R   Rb   (    (    R   Rc   X  s    
c   
      C   s  t  | t  p1 | d  j o t i d t  qA t d   n t |  p t d   n |  i } |  i } |  i d j o t | d d  d j o | d }	 t |	 d	  p t d
   n | d  j	 o  |	 | i j	 o t d   n | d } | |	  | |  | t  n | |  | |  | t  | d  j	 o |  i |  n | d  j	 o |  i |  n | d  j	 o |  i |  n | d  j	 o | |  | t  n d  S(   Ns'   __basicnew__ special case is deprecateds$   args from reduce() should be a tuples#   func from reduce should be callablei   R
   t    t
   __newobj__i    t   __new__s+   args[0] from __newobj__ args has no __new__s0   args[0] from __newobj__ args has the wrong classi   (   t
   isinstancet   argsRr   R<   R?   R@   RA   R   t   callablet   funcR   RM   RD   RG   Rp   t   clst   hasattrRN   t	   __class__t   NEWOBJt   REDUCERU   t	   listitemst   _batch_appendst	   dictitemst   _batch_setitemst   statet   BUILD(
   R   R}   R{   R   R   R   RN   RD   RM   R~   (    (    R   Rs   `  s>    			)







c         C   s   |  i t  d  S(   N(   R   RD   t   NONE(   R   RN   (    (    R   t	   save_none  s    c         C   sN   |  i d j o |  i | o t p t  n |  i | o t p t  d  S(   Ni   (   R   RG   RD   RN   t   NEWTRUEt   NEWFALSEt   TRUEt   FALSE(   R   RN   (    (    R   t	   save_bool  s    c         C   s   |  i o | d j og | d j o |  i t t |   d  Sn | d j o* |  i d t | d @| d ?f  d  Sq~ n | d ?} | d j p | d j o" |  i t | d |   d  Sq n |  i t
 t |  d	  d  S(
   Ni    i   i  s   %c%c%ci   i   is   <is   
(   R   R=   RN   RD   t   BININT1RL   t   BININT2t	   high_bitst   BININTRX   t   INTRZ   (   R   RN   RX   R   (    (    R   t   save_int  s    
"
c         C   s   |  i d j oj t |  } t |  } | d j  o |  i t t	 |  |  n |  i t
 | d |  |  d  Sn |  i t t |  d  d  S(   Ni   i   s   <is   
(   R   RG   t   encode_longRN   t   bytesRR   t   nRD   t   LONG1RL   t   LONG4RX   t   LONGRZ   (   R   RN   RX   R   R   (    (    R   t	   save_long  s    c         C   sG   |  i o |  i t | d |   n |  i t t |  d  d  S(   Ns   >ds   
(   R   R=   RD   t   BINFLOATRX   RN   t   FLOATRZ   (   R   RN   RX   (    (    R   t
   save_float  s    
c         C   s   |  i oZ t |  } | d j  o |  i t t |  |  q |  i t | d |  |  n |  i t
 t |  d  |  i |  d  S(   Ni   s   <is   
(   R   R=   RR   RN   R   RD   t   SHORT_BINSTRINGRL   t	   BINSTRINGRX   t   STRINGRZ   RU   (   R   RN   RX   R   (    (    R   t   save_string  s    
"c         C   s   |  i o= | i d  } t |  } |  i t | d |  |  nC | i
 d d  } | i
 d d  } |  i t | i d  d  |  i |  d  S(   Ns   utf-8s   <is   \s   \u005cs   
s   \u000as   raw-unicode-escape(   R   R=   RN   t   encodet   encodingRR   R   RD   t
   BINUNICODERX   t   replacet   UNICODERU   (   R   RN   RX   R   R   (    (    R   t   save_unicode  s    
"c         C   s7  | i   } |  i o | o | i d  } n t |  } | d j  o' | o |  i t	 t
 |  |  q&| d |  } | o |  i t | |  q&|  i t | |  no | oL | i d d  } | i d d  } | i d  } |  i t | d  n |  i t t |  d  |  i |  d  S(	   Ns   utf-8i   s   <is   \s   \u005cs   
s   \u000as   raw-unicode-escape(   RN   t	   isunicodet   unicodeR   R=   R   RR   R0   RD   R   RL   RX   R6   R   R   R   R   R   RZ   RU   (   R   RN   RX   R6   R0   R   (    (    R   R     s$    
c   	      C   s  |  i } |  i } t |  } | d j o+ | o | t  n | t t  d  Sn |  i	 } |  i
 } | d j o | d j o x | D] } | |  q Wt |  | j o3 |  i | t |  d  } | t | |  n | t |  |  i |  d  Sn | t  x | D] } | |  qWt |  | j oT |  i | t |  d  } | o | t |  n | t | d |  d  Sn |  i t  |  i |  d  S(   Ni    i   i   i   (   R   RD   RG   RR   RN   R   t   EMPTY_TUPLEt   MARKt   TUPLERM   RE   t   elementRP   R^   t   POPt   _tuplesize2codeRU   t   POP_MARK(	   R   RN   RM   RG   R   RD   R   R^   RE   (    (    R   t
   save_tuple"  s@    				 
 c         C   s   |  i t  d  S(   N(   R   RD   R   (   R   RN   (    (    R   t   save_empty_tupleZ  s    c         C   sS   |  i } |  i o | t  n | t t  |  i |  |  i t	 |   d  S(   N(
   R   RD   R=   t
   EMPTY_LISTR   t   LISTRU   RN   R   t   iter(   R   RN   RD   (    (    R   t	   save_list]  s    	
i  c   	      C   s1  |  i } |  i } |  i p- x" | D] } | |  | t  q# Wd  Sn t |  i  } x | d  j	 o g  } xH | D]@ } y | i   } | i |  Wqu t j
 o d  } Pqu Xqu Wt |  } | d j o3 | t  x | D] } | |  q W| t  q[ | o | | d  | t  q[ q[ Wd  S(   Ni   i    (   R   RM   RD   R=   t   itemsRd   t   APPENDt   xranget
   _BATCHSIZER5   R<   t   tmpR.   t   nextt   appendt   StopIterationRR   R   R   t   APPENDS(	   R   R   R   R.   R   RD   R5   Rd   RM   (    (    R   R   n  s<    		
 
  

 c         C   sS   |  i } |  i o | t  n | t t  |  i |  |  i | i	    d  S(   N(
   R   RD   R=   t
   EMPTY_DICTR   t   DICTRU   RN   R   t	   iteritems(   R   RN   RD   (    (    R   t	   save_dict  s    	
c   
      C   sa  |  i } |  i } |  i p= x2 | D]* \ }	 } | |	  | |  | t  q# Wd  Sn t |  i	  } x | d  j	 o g  } xB | D]: } y | i | i    Wq t j
 o d  } Pq Xq Wt |  } | d j oC | t  x( | D]  \ }	 } | |	  | |  q W| t  qk | o2 | d \ }	 } | |	  | |  | t  qk qk Wd  S(   Ni   i    (   R   RM   RD   R=   R   t   kt   vt   SETITEMR   R   R5   R<   R   R.   R   R   R   RR   R   R   t   SETITEMS(
   R   R   R   R.   R   RD   R5   R   RM   R   (    (    R   R     sB    		
 

  

 


c   
      C   sJ  | i }	 |  i } |  i } |  i } t | d  o' | i   } t
 |  t | |  n f  } | t  |  i o3 | |	  x | D] } | |  q W| t  n< x | D] } | |  q W| t |	 i d |	 i d  |  i |  y | i } Wn t j
 o | i } n X|   } t | |  | |  | t  d  S(   Nt   __getinitargs__s   
(   RN   R   R~   R   RE   RD   RM   R   R   R{   RR   t   _keep_aliveR   R=   t   argt   OBJt   INSTR   R
   RU   t   __getstate__t   getstatet   AttributeErrort   __dict__t   stuffR   (
   R   RN   R   R{   RD   R   R   RM   RE   R~   (    (    R   t	   save_inst  s:    				



   	
c   
      C   s  |  i } |  i } | d  j o | i } n t | d d   } | d  j o t	 | |  } n y* t
 |  t i | } t | |  }	 Wn5 t t t f j
 o  t d | | | f   n, X|	 | j	 o t d | | | f   n |  i d j o t i | | f  } | o | d j p t  | d j o | t t |   nH | d j o# | d t | d @| d	 ?f  n | t | d
 |   d  Sqn | t | d | d  |  i |  d  S(   NR   s(   Can't pickle %r: it's not found as %s.%ss2   Can't pickle %r: it's not the same object as %s.%si   i    i   i  s   %c%c%ci   s   <is   
(   R   RD   RE   t   nameR<   RN   R
   Rp   t   modulet   whichmodulet
   __import__t   syst   modulest   modt   klasst   ImportErrort   KeyErrorR   R   RG   t   _extension_registryR^   t   codeRQ   t   EXT1RL   t   EXT2t   EXT4RX   t   GLOBALRU   (
   R   RN   R   RX   R   R   RD   RE   R   R   (    (    R   Rl     s6    		
#(0   R
   R   R<   R   RJ   R   RU   t   structRX   RT   R^   RM   Ra   Rc   Rs   Rf   R   t   NoneTypeR   t   boolR   t   IntTypeR   t   LongTypeR   t	   FloatTypeR   Rq   R   t   UnicodeTypeR   Rr   R   R   t   ListTypeR   R   R   t   DictionaryTypet   PyStringMapR   R   t   InstanceTypeRl   t	   ClassTypet   FunctionTypet   BuiltinFunctionTypeRi   (    (    (    R   R      s^   *			
		@		V	
	








	3
		
	 	
	#	&
(


c         C   sH   y | t |  i |   Wn& t j
 o |  g | t |  <n Xd S(   sM  Keeps a reference to the object x in the memo.

    Because we remember objects by their id, we have
    to assure that possibly temporary objects are kept
    alive by referencing them.
    We store a reference at the id of the memo, which should
    normally not be used unless someone tries to deepcopy
    the memo itself...
    N(   RE   RP   R   Rd   R   (   Rd   RE   (    (    R   R     s
    	 c         C   s   t  |  d d  } | d j	 o | Sn |  t j o t |  Sn xb t i i   D]K \ } } | d j o qP n | d j o t  | | d  |  j o PqP qP Wd } | t |  <| S(   s   Figure out the module in which a function occurs.

    Search sys.modules for the module.
    Cache in classmap.
    Return a module name.
    If the function cannot be found, return "__main__".
    R   t   __main__N(   Rp   R}   R<   R   t   classmapR   R   R   R   R   t   funcname(   R}   R   R   R   R   (    (    R   R   -  s      &	
c           B   sL  t  Z d   Z d   Z d   Z h  Z d   Z e e d <d   Z e e e <d   Z	 e	 e e
 <d   Z e e e <d	   Z e e e <d
   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e <d   Z e e e  <d   Z! e! e e" <e# i$ d  Z% e% e e& <d   Z' e' e e( <d   Z) e) e e* <d   Z+ e+ e e, <d   Z- e- e e. <d   Z/ e/ e e0 <d   Z1 e1 e e2 <d   Z3 e3 e e4 <d   Z5 e5 e e6 <d   Z7 e7 e e8 <d   Z9 e9 e e: <d   Z; e; e e< <d    Z= e= e e> <d!   Z? e? e e@ <d"   ZA eA e eB <d#   ZC d$   ZD eD e eE <d%   ZF eF e eG <d&   ZH eH e eI <d'   ZJ eJ e eK <d(   ZL eL e eM <d)   ZN eN e eO <d*   ZP eP e eQ <d+   ZR d,   ZS d-   ZT eT e eU <d.   ZV eV e eW <d/   ZX eX e eY <d0   ZZ eZ e e[ <d1   Z\ e\ e e] <d2   Z^ e^ e e_ <d3   Z` e` e ea <d4   Zb eb e ec <d5   Zd ed e ee <d6   Zf ef e eg <d7   Zh eh e ei <d8   Zj ej e ek <d9   Zl el e em <d:   Zn en e eo <d;   Zp ep e eq <d<   Zr er e es <d=   Zt et e eu <RS(>   Nc         C   s%   | i |  _ | i |  _ h  |  _ d S(   s  This takes a file-like object for reading a pickle data stream.

        The protocol version of the pickle is detected automatically, so no
        proto argument is needed.

        The file-like object must have two methods, a read() method that
        takes an integer argument, and a readline() method that requires no
        arguments.  Both methods should return a string.  Thus file-like
        object can be a file object opened for reading, a StringIO object,
        or any other custom object that meets this interface.
        N(   RC   t   readlineR   t   readRE   (   R   RC   (    (    R   R   K  s     c         C   s   t    |  _ g  |  _ |  i i |  _ |  i } |  i } y& x | d  } | | |   q< WWn t j
 o } | i
 Sn Xd S(   s   Read a pickled object representation from the open file.

        Return the reconstituted object hierarchy specified in the file.
        i   N(   t   objectR   t   markt   stackR   R   Rf   t   keyR   t   stopinstR   (   R   R   Rf   R   R   (    (    R   R   [  s     			  c         C   sI   |  i } |  i } t |  d } x  | | | j	 o | d } q% W| S(   Ni   (   R   R   R   RR   R   (   R   R   R   R   (    (    R   t   markert  s    		  c         C   s
   t   d  S(   N(   t   EOFError(   R   (    (    R   t   load_eof}  s    Rw   c         C   sH   t  |  i d   } d | j o
 d j n p t d |  n d  S(   Ni   i    i   s   unsupported pickle protocol: %d(   t   ordR   R   RG   R>   (   R   RG   (    (    R   t
   load_proto  s    c         C   s*   |  i   d  } |  i |  i |   d  S(   Ni(   R   R   Rb   R   t   persistent_load(   R   Rb   (    (    R   t   load_persid  s    c         C   s)   |  i i   } |  i |  i |   d  S(   N(   R   R   t   popRb   R   R  (   R   Rb   (    (    R   t   load_binpersid  s    c         C   s   |  i d   d  S(   N(   R   R   R<   (   R   (    (    R   t	   load_none  s    c         C   s   |  i t  d  S(   N(   R   R   t   False(   R   (    (    R   t
   load_false  s    c         C   s   |  i t  d  S(   N(   R   R   t   True(   R   (    (    R   t	   load_true  s    c         C   s   |  i   } | t d j o
 t } nN | t d j o
 t } n3 y t |  } Wn t	 j
 o t
 |  } n X|  i |  d  S(   Ni   (   R   R   t   dataR   R  t   valR   R	  RF   R>   t   longR   (   R   R  R  (    (    R   t   load_int  s    

c         C   s$   |  i t d |  i d    d  S(   NR.   i   (   R   R   t   mloadsR   (   R   (    (    R   t   load_binint  s    c         C   s    |  i t |  i d    d  S(   Ni   (   R   R   R   R   (   R   (    (    R   t   load_binint1  s    c         C   s(   |  i t d |  i d  d   d  S(   NR.   i   t     (   R   R   R  R   (   R   (    (    R   t   load_binint2  s    c         C   s$   |  i t |  i   d  d   d  S(   Nii    (   R   R   R  R   (   R   (    (    R   t	   load_long  s    c         C   s;   t  |  i d   } |  i |  } |  i t |   d  S(   Ni   (   R   R   R   R   R   R   t   decode_long(   R   R   R   (    (    R   t
   load_long1  s    c         C   s?   t  d |  i d   } |  i |  } |  i t |   d  S(   NR.   i   (   R  R   R   R   R   R   R  (   R   R   R   (    (    R   t
   load_long4  s    c         C   s!   |  i t |  i   d    d  S(   Ni(   R   R   t   floatR   (   R   (    (    R   t
   load_float  s    c         C   s'   |  i | d |  i d   d  d  S(   Ns   >di   i    (   R   R   t   unpackR   (   R   R  (    (    R   t   load_binfloat  s    c         C   s   |  i   d  } xc d D]R } | i |  o< | i |  p t d  n | t |  t |  !} Pq q Wt d  |  i | i	 d   d  S(   Nis   "'s   insecure string pickles   string-escape(
   R   R   t   repR4   t
   startswitht   endswithR>   RR   R   t   decode(   R   R4   R  (    (    R   t   load_string  s     		c         C   s3   t  d |  i d   } |  i |  i |   d  S(   NR.   i   (   R  R   R   RR   R   (   R   RR   (    (    R   t   load_binstring  s    c         C   s$   |  i t |  i   d  d   d  S(   Nis   raw-unicode-escape(   R   R   R   R   (   R   (    (    R   t   load_unicode  s    c         C   s<   t  d |  i d   } |  i t |  i |  d   d  S(   NR.   i   s   utf-8(   R  R   R   RR   R   R   (   R   RR   (    (    R   t   load_binunicode  s    c         C   s/   t  |  i d   } |  i |  i |   d  S(   Ni   (   R   R   R   RR   R   (   R   RR   (    (    R   t   load_short_binstring  s    c         C   s1   |  i   } t |  i | d  g |  i | )d  S(   Ni   (   R   R   R   t   tupleR   (   R   R   (    (    R   t
   load_tuple  s    c         C   s   |  i i f   d  S(   N(   R   R   R   (   R   (    (    R   t   load_empty_tuple  s    c         C   s   |  i d f |  i d <d  S(   Ni(   R   R   (   R   (    (    R   t   load_tuple1  s    c         C   s(   |  i d |  i d f g |  i d )d  S(   Nii(   R   R   (   R   (    (    R   t   load_tuple2  s    c         C   s2   |  i d |  i d |  i d f g |  i d )d  S(   Niii(   R   R   (   R   (    (    R   t   load_tuple3   s    c         C   s   |  i i g   d  S(   N(   R   R   R   (   R   (    (    R   t   load_empty_list  s    c         C   s   |  i i h   d  S(   N(   R   R   R   (   R   (    (    R   t   load_empty_dictionary  s    c         C   s+   |  i   } |  i | d g |  i | )d  S(   Ni   (   R   R   R   R   (   R   R   (    (    R   t	   load_list  s    c         C   s|   |  i   } h  } |  i | d } xB t d t |  d  D]( } | | } | | d } | | | <q< W| g |  i | )d  S(   Ni   i    i   (   R   R   R   R)   R   R   t   rangeRR   R.   R   R   (   R   R)   R.   R   R   R   R   (    (    R   t	   load_dict  s     
c         C   s   t  |  i | d  } |  i | 3d } | oZ t |  t j oG t	 | d  o6 y t
   } | | _ d } Wq t j
 o q Xn | pU y | |   } Wq t j
 o2 } t d | i t |  f t i   d  q Xn |  i |  d  S(   Ni   i    R   s   in constructor for %s: %si   (   R%  R   R   R   R{   t   instantiatedRe   R   R   R   t   _EmptyClassR   R   t   RuntimeErrorRk   t   errR
   Rv   R   t   exc_infoR   (   R   R   R   R3  R0  R{   R   (    (    R   t   _instantiate!  s     
,		
	2c         C   sL   |  i   d  } |  i   d  } |  i | |  } |  i | |  i    d  S(   Ni(   R   R   R   R   t
   find_classR   R5  R   (   R   R   R   R   (    (    R   t	   load_inst8  s    c         C   s6   |  i   } |  i i | d  } |  i | |  d  S(   Ni   (   R   R   R   R   R  R   R5  (   R   R   R   (    (    R   t   load_obj?  s    c         C   s?   |  i i   } |  i d } | i | |  } | |  i d <d  S(   Ni(   R   R   R  R{   R~   Ry   RN   (   R   R{   RN   R~   (    (    R   t   load_newobjF  s    c         C   sC   |  i   d  } |  i   d  } |  i | |  } |  i |  d  S(   Ni(   R   R   R   R   R6  R   R   (   R   R   R   R   (    (    R   t   load_globalM  s    c         C   s&   t  |  i d   } |  i |  d  S(   Ni   (   R   R   R   R   t   get_extension(   R   R   (    (    R   t	   load_ext1T  s    c         C   s.   t  d |  i d  d  } |  i |  d  S(   NR.   i   R  (   R  R   R   R   R;  (   R   R   (    (    R   t	   load_ext2Y  s    c         C   s*   t  d |  i d   } |  i |  d  S(   NR.   i   (   R  R   R   R   R;  (   R   R   (    (    R   t	   load_ext4^  s    c         C   s   g  } t i | |  } | | j	 o |  i |  d  Sn t i |  } | p t	 d |   n |  i
 |   } | t | <|  i |  d  S(   Ns   unregistered extension code %d(   t   nilt   _extension_cacheR^   R   RN   R   R   t   _inverted_registryR   R>   R6  (   R   R   RN   R?  R   (    (    R   R;  c  s    
c         C   s*   t  |  t i | } t | |  } | S(   N(   R   R   R   R   R   Rp   R   R   (   R   R   R   R   R   (    (    R   R6  p  s    
c         C   sf   |  i } | i   } | d } | d  j o  t i d t  | i	   } n | |   } | | d <d  S(   Nis'   __basicnew__ special case is deprecated(   R   R   R  R{   R}   R<   R?   R@   RA   t   __basicnew__R   (   R   R{   R   R}   R   (    (    R   t   load_reducew  s    	
	c         C   s   |  i d =d  S(   Ni(   R   R   (   R   (    (    R   t   load_pop  s    c         C   s   |  i   } |  i | 3d  S(   N(   R   R   R   R   (   R   R   (    (    R   t   load_pop_mark  s    c         C   s   |  i |  i d  d  S(   Ni(   R   R   R   (   R   (    (    R   t   load_dup  s    c         C   s"   |  i |  i |  i   d   d  S(   Ni(   R   R   RE   R   (   R   (    (    R   t   load_get  s    c         C   s3   t  |  i d   } |  i |  i t |   d  S(   Ni   (   R   R   R   R.   R   RE   RZ   (   R   R.   (    (    R   t   load_binget  s    c         C   s7   t  d |  i d   } |  i |  i t |   d  S(   NR.   i   (   R  R   R   R.   R   RE   RZ   (   R   R.   (    (    R   t   load_long_binget  s    c         C   s"   |  i d |  i |  i   d  <d  S(   Ni(   R   R   RE   R   (   R   (    (    R   t   load_put  s    c         C   s3   t  |  i d   } |  i d |  i t |  <d  S(   Ni   i(   R   R   R   R.   R   RE   RZ   (   R   R.   (    (    R   t   load_binput  s    c         C   s7   t  d |  i d   } |  i d |  i t |  <d  S(   NR.   i   i(   R  R   R   R.   R   RE   RZ   (   R   R.   (    (    R   t   load_long_binput  s    c         C   s0   |  i } | i   } | d } | i |  d  S(   Ni(   R   R   R  R   t   listR   (   R   RM  R   R   (    (    R   t   load_append  s    	
c         C   sC   |  i } |  i   } | | d } | i | | d  | | 3d  S(   Ni   (   R   R   R   R   RM  t   extend(   R   RM  R   R   (    (    R   t   load_appends  s
    	c         C   s9   |  i } | i   } | i   } | d } | | | <d  S(   Ni(   R   R   R  R   R   t   dict(   R   R   RQ  R   R   (    (    R   t   load_setitem  s
    	
c         C   sk   |  i } |  i   } | | d } x: t | d t |  d  D] } | | d | | | <q@ W| | 3d  S(   Ni   i   (   R   R   R   R   RQ  R.  RR   R.   (   R   R.   R   RQ  R   (    (    R   t   load_setitems  s    	 c         C   s!  |  i } | i   } | d } t | d d   } | o | |  d  Sn d  } t	 | t
  o# t |  d j o | \ } } n | o[ y | i i |  Wq t j
 o4 x/ | i   D] \ } } t | | |  q Wq Xn | o1 x. | i   D] \ } } t | | |  q Wn d  S(   Nit   __setstate__i   (   R   R   R  R   t   instRp   R<   t   setstatet	   slotstateRz   R%  RR   R   t   updateR2  R   R   R   t   setattr(   R   R   RU  R   RW  R   R   RV  (    (    R   t
   load_build  s*    	

#
  c         C   s   |  i |  i  d  S(   N(   R   R   R   (   R   (    (    R   t	   load_mark  s    c         C   s   |  i i   } t |   d  S(   N(   R   R   R  R   R   (   R   R   (    (    R   t	   load_stop  s    (v   R
   R   R   R   R   Rf   R   R  RK   R  Ru   R  Rt   R  R   R  R   R
  R   R  R   R  R   R  R   R  R   R  R   R  R   R  R   R  R   R   R  R  R   R   R   R!  R   R"  R   R#  R   R$  R   R&  R   R'  R   R(  t   TUPLE1R)  t   TUPLE2R*  t   TUPLE3R+  R   R,  R   R-  R   R/  R   R5  R7  R   R8  R   R9  R   R:  R   R<  R   R=  R   R>  R   R;  R6  RC  R   RD  R   RE  R   RF  t   DUPRG  R]   RH  R[   RI  R\   RJ  RY   RK  RV   RL  RW   RN  R   RP  R   RR  R   RS  R   RZ  R   R[  R   R\  RO   (    (    (    R   R   I  s   				
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	
	
	
	
	
	
	
	
	
	
	
	
		
		
	
	
	
	
	
	
			
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	R1  c           B   s   t  Z RS(   N(   R
   R   (    (    (    R   R1    s   c         C   s9  |  d j o d Sn |  d j o t |   } | i d  p t  d | i d  } t |  | } | d @o d | d } qt	 | d d  d	 j o d
 | d } qnt |   } | i d  p t  d | i d  } t |  | } | d @o | d 7} n | d } |  d | >7}  |  d j p t  t |   } d | i d  } t |  | } | | j  o d d | | | d } n t	 | d d  d	 j  o d | d } n | i d  o | d d !} n | d } t |  d @d j p t |  | f  t i |  } | d d d  S(   s  Encode a long to a two's complement little-endian binary string.
    Note that 0L is a special case, returning an empty string, to save a
    byte in the LONG1 pickling context.

    >>> encode_long(0L)
    ''
    >>> encode_long(255L)
    '\xff\x00'
    >>> encode_long(32767L)
    '\xff\x7f'
    >>> encode_long(-256L)
    '\x00\xff'
    >>> encode_long(-32768L)
    '\x00\x80'
    >>> encode_long(-128L)
    '\x80'
    >>> encode_long(127L)
    '\x7f'
    >>>
    i    Rw   t   0xi   R   i   t   0x0i   i   t   0x00i   l    R   t   0xffiN(   Rd   t   hext   ashexR  RQ   R  t
   njunkcharsRR   t   nibblesRF   t   nbitst
   newnibblest	   _binasciit	   unhexlifyt   binary(   Rd   Rm  Ri  Rh  Rg  Rj  Rf  (    (    R   R      sD     

'c         C   sw   t  |   } | d j o d Sn t i |  d d d   } t | d  } |  d d j o | d | d >8} n | S(	   s\  Decode a long from a two's complement little-endian binary string.

    >>> decode_long('')
    0L
    >>> decode_long("\xff\x00")
    255L
    >>> decode_long("\xff\x7f")
    32767L
    >>> decode_long("\x00\xff")
    -256L
    >>> decode_long("\x00\x80")
    -32768L
    >>> decode_long("\x80")
    -128L
    >>> decode_long("\x7f")
    127L
    i    l    Nii   s   l    i   (   RR   R  t   nbytesRk  t   hexlifyRf  R  R   (   R  R   Rn  Rf  (    (    R   R  B  s     (   s   StringIOc         C   s   t  | | |  i |   d  S(   N(   R   RC   R;   R=   R   RN   (   RN   RC   R;   R=   (    (    R   R   e  s    c         C   s,   t    } t | | |  i |   | i   S(   N(   t   StringIORC   R   R;   R=   R   RN   t   getvalue(   RN   R;   R=   RC   (    (    R   R   h  s    	c         C   s   t  |   i   S(   N(   R   RC   R   (   RC   (    (    R   R   m  s    c         C   s   t  |   } t |  i   S(   N(   Rp  Rv   RC   R   R   (   Rv   RC   (    (    R   R	   p  s    c          C   s   d  k  }  |  i   S(   N(   t   doctestt   testmod(   Rr  (    (    R   t   _testv  s    	R   (l   R   t   __version__t   typest   copy_regRm   R   RA  R@  t   marshalR   R   t   reR?   t   __all__t   format_versiont   compatible_formatsRB   R	   R  t	   ExceptionR   R   R   R   t   org.python.coreR   R   R<   R   t	   NameErrorR   RO   R   R   R`  R   R   R   R   R   R   R   Ru   Rt   R   R   R   R   R   R   R   R   R   R   R   R   R]   R[   R   R\   R   R   R   RY   RV   RW   R   R   R   R   R   R   R   RK   R   R   R   R   R]  R^  R_  R   R   R   R   R   RO  t   _[1]t   dirRd   t   matchR   R   R   R   R   R1  t   binasciiRk  R   R  t	   cStringIORp  R   R   R   Rt  R
   (^   R   R   R   R   R   R   R   R   R   R1  R   R   R   R   R  R   Rd   R	   R   R{  R   R]  R^  R_  Rm   Rt   R   Rz  R]   RV   R   Ry  Rk  R   R[   RK   R   R   R   Rp  R   R@  R   R   Ru   R   RB   Rt  R   RO   R   R   R   R   R   R   R   R   R   R\   R   R   R   R   R`  R   R   R   R   R   R   RY   R   RA  R   R  R   RW   R   R   Ru  R   R?   R   R   R   R   R   Rx  R  R   R   R   R|  (    (    R   t   ?   s   					!		B  m		 		B				