³ò žl‡Jc@sØdZddklZdddddgZhZdd„Zd „Zye Wne j onXd „Z ee e e ƒd „Z dZ d„Zd„Zd„ZhZhZhZd„Zd„Zd„ZdS(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. iÿÿÿÿ(t ClassTypetpicklet constructort add_extensiontremove_extensiontclear_extension_cachecCsit|ƒtjotdƒ‚nt|ƒptdƒ‚n|t|<|dj ot|ƒndS(Ns-copy_reg is not intended for use with classess$reduction functions must be callable(ttypet _ClassTypet TypeErrortcallabletdispatch_tabletNoneR(tob_typetpickle_functiontconstructor_ob((s/sys/lib/python/copy_reg.pyRs   cCs!t|ƒptdƒ‚ndS(Nsconstructors must be callable(R R(tobject((s/sys/lib/python/copy_reg.pyRs cCst|i|iffS(N(tcomplextrealtimag(tc((s/sys/lib/python/copy_reg.pytpickle_complex'scCsF|tjoti|ƒ}n#|i||ƒ}|i||ƒ|S(N(Rt__new__t__init__(tclstbasetstatetobj((s/sys/lib/python/copy_reg.pyt_reconstructor.s  ii cCs8x>|iiD]*}t|dƒo|it@ oPq q Wt}|tjo d}n1||ijotd|i‚n||ƒ}|i||f}y |i }Wn_t j oSt |ddƒotdƒ‚ny |i }Wqt j o d}qXn X|ƒ}|ot ||fSn t |fSdS(Nt __flags__scan't pickle %s objectst __slots__sNa class that defines __slots__ without defining __getstate__ cannot be pickled(t __class__t__mro__thasattrRt _HEAPTYPERR Rt__name__t __getstate__tAttributeErrortgetattrt__dict__R(tselftprotoRRtargstgetstatetdict((s/sys/lib/python/copy_reg.pyt _reduce_ex:s0        cGs|i||ŒS(N(R(RR)((s/sys/lib/python/copy_reg.pyt __newobj__[scCs|iidƒ}|dj o|Sng}t|dƒpnÄxÀ|iD]µ}d|ijoŸ|id}t|tƒo |f}nxr|D]f}|djoq’q’|idƒo/|idƒ o|i d|i |fƒq’|i |ƒq’WqKqKWy ||_ WnnX|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.) t __slotnames__RR&t __weakref__t__s_%s%sN(s__dict__s __weakref__( R&tgetR R Rt isinstancet basestringt startswithtendswithtappendR"R.(RtnamesRtslotstname((s/sys/lib/python/copy_reg.pyt _slotnames^s0      ! cCsåt|ƒ}d|jo djnp td‚n||f}ti|ƒ|joti|ƒ|jodSn|tjotd|t|fƒ‚n|tjotd|t|fƒ‚n|t|<|t|R<t_extension_cache(R?R9R@RA((s/sys/lib/python/copy_reg.pyR®s  cCstiƒdS(N(RBtclear(((s/sys/lib/python/copy_reg.pyRºsNi(t__doc__ttypesRRt__all__R R RRRt NameErrorRRR!R,R-R:R=R>RBRRR(((s/sys/lib/python/copy_reg.pyss.    !  8