;ò
ìŒü?c           @   sÙ   d  Z  d k l Z d d d d d g Z h  Z e d „ Z d „  Z y e	 Wn e
 j
 o n Xd	 „  Z e e	 e e	 ƒ d
 „  Z d d >Z d „  Z d „  Z d „  Z h  Z h  Z h  Z d „  Z d „  Z d „  Z d S(   s¬   Helper to provide extensibility for pickle/cPickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
(   s	   ClassTypes   pickles   constructors   add_extensions   remove_extensions   clear_extension_cachec         C   sj   t  |  ƒ t j o t d ƒ ‚ n t | ƒ o t d ƒ ‚ n | t |  <| t j	 o t	 | ƒ n d  S(   Ns-   copy_reg is not intended for use with classess$   reduction functions must be callable(
   s   types   ob_types
   _ClassTypes	   TypeErrors   callables   pickle_functions   dispatch_tables   constructor_obs   Nones   constructor(   s   ob_types   pickle_functions   constructor_ob(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   pickle   s    
c         C   s"   t  |  ƒ o t d ƒ ‚ n d  S(   Ns   constructors must be callable(   s   callables   objects	   TypeError(   s   object(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   constructor   s    c         C   s   t  |  i |  i f f Sd  S(   N(   s   complexs   cs   reals   imag(   s   c(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   pickle_complex'   s    c         C   sJ   | t j o t i |  ƒ } n# | i |  | ƒ } | i | | ƒ | Sd  S(   N(   s   bases   objects   __new__s   clss   objs   states   __init__(   s   clss   bases   states   obj(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   _reconstructor.   s
    i   i	   c         C   s8  x> |  i i D]* } t | d ƒ o | i t @o Pq q Wt } | t j o
 t } n1 | |  i j o t
 d | i ‚ n | |  ƒ } |  i | | f } y |  i } Wn_ t j
 oS t |  d t ƒ o t
 d ƒ ‚ n y |  i } Wqt j
 o t } qXn X| ƒ  } | o t | | f Sn t | f Sd  S(   Ns	   __flags__s   can't pickle %s objectss	   __slots__sN   a class that defines __slots__ without defining __getstate__ cannot be pickled(   s   selfs	   __class__s   __mro__s   bases   hasattrs	   __flags__s	   _HEAPTYPEs   objects   Nones   states	   TypeErrors   __name__s   argss   __getstate__s   getstates   AttributeErrors   getattrs   __dict__s   dicts   _reconstructor(   s   selfs   protos   argss   getstates   states   bases   dict(    (    s%   /mit/python/lib/python2.3/copy_reg.pys
   _reduce_ex:   s2      	
	c         G   s   |  i |  | Œ Sd  S(   N(   s   clss   __new__s   args(   s   clss   args(    (    s%   /mit/python/lib/python2.3/copy_reg.pys
   __newobj__[   s    c         C   sÒ   |  i i d ƒ } | t j	 o | Sn g  } t |  d ƒ o nr xn |  i D]c } d | i j oM | g  i } | i d D]' } | d d f j o | | ƒ qz qz ~ 7} qL qL Wy | |  _ Wn n X| Sd S(   s›  Return a list of slot names for a given class.

    This needs to find slots defined by the class and its bases, so we
    can't simply return the __slots__ attribute.  We must walk down
    the Method Resolution Order and concatenate the __slots__ of each
    class found there.  (This assumes classes don't modify their
    __slots__ attribute to misrepresent their slots after the class is
    defined.)
    s   __slotnames__s	   __slots__s   __dict__s   __weakref__N(   s   clss   __dict__s   gets   namess   Nones   hasattrs   __mro__s   cs   appends   _[1]s   names   __slotnames__(   s   clss   cs   names   _[1]s   names(    (    s%   /mit/python/lib/python2.3/copy_reg.pys
   _slotnames^   s     	 
 Qc         C   sæ   t  | ƒ } d | j o
 d j n o t d ‚ n |  | f } t i | ƒ | j o t i | ƒ | j o d Sn | t j o t d | t | f ƒ ‚ n | t j o t d | t | f ƒ ‚ n | t | <| t | <d S(   s   Register an extension code.i   iÿÿÿs   code out of rangeNs)   key %s is already registered with code %ss$   code %s is already in use for key %s(	   s   ints   codes
   ValueErrors   modules   names   keys   _extension_registrys   gets   _inverted_registry(   s   modules   names   codes   key(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   add_extension‘   s     ,
c         C   s|   |  | f } t i | ƒ | j p t i | ƒ | j o t d | | f ƒ ‚ n t | =t | =| t j o t | =n d S(   s0   Unregister an extension code.  For testing only.s%   key %s is not registered with code %sN(	   s   modules   names   keys   _extension_registrys   gets   codes   _inverted_registrys
   ValueErrors   _extension_cache(   s   modules   names   codes   key(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   remove_extension£   s     ,c           C   s   t  i ƒ  d  S(   N(   s   _extension_caches   clear(    (    (    s%   /mit/python/lib/python2.3/copy_reg.pys   clear_extension_cache¯   s    N(   s   __doc__s   typess	   ClassTypes
   _ClassTypes   __all__s   dispatch_tables   Nones   pickles   constructors   complexs	   NameErrors   pickle_complexs   _reconstructors	   _HEAPTYPEs
   _reduce_exs
   __newobj__s
   _slotnamess   _extension_registrys   _inverted_registrys   _extension_caches   add_extensions   remove_extensions   clear_extension_cache(   s   _inverted_registrys   clear_extension_caches   __all__s   _extension_registrys   _extension_caches   _reconstructors
   __newobj__s	   _HEAPTYPEs
   _reduce_exs   add_extensions
   _ClassTypes   pickle_complexs   constructors   remove_extensions
   _slotnamess   pickles   dispatch_table(    (    s%   /mit/python/lib/python2.3/copy_reg.pys   ?   s,   			
	!		-		