ó zfc@sÖdZddlmZdddddgZiZdd„Zd „Zye Wne k ranXd „Z ee e e ƒd „Z dZ d„Zd„Zd„ZiZiZiZd„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_cachecCsft|ƒtkr!tdƒ‚nt|dƒs?tdƒ‚n|t|<|dk rbt|ƒndS(Ns-copy_reg is not intended for use with classest__call__s$reduction functions must be callable(ttypet _ClassTypet TypeErrorthasattrtdispatch_tabletNoneR(tob_typetpickle_functiontconstructor_ob((s /usr/lib64/python2.7/copy_reg.pyRs  cCs"t|dƒstdƒ‚ndS(NRsconstructors must be callable(R R (tobject((s /usr/lib64/python2.7/copy_reg.pyRscCst|j|jffS(N(tcomplextrealtimag(tc((s /usr/lib64/python2.7/copy_reg.pytpickle_complex'scCsY|tkrtj|ƒ}n7|j||ƒ}|jtjkrU|j||ƒn|S(N(Rt__new__t__init__(tclstbasetstatetobj((s /usr/lib64/python2.7/copy_reg.pyt_reconstructor.s  ii cCs&x;|jjD]'}t|dƒr |jt@ r Pq q Wt}|tkrSd}n.||jkrutd|j‚n||ƒ}|j||f}y |j }WnYt k rût |ddƒrÑtdƒ‚ny |j }Wqt k r÷d}qXn X|ƒ}|rt ||fSt |fSdS(Nt __flags__scan't pickle %s objectst __slots__sNa class that defines __slots__ without defining __getstate__ cannot be pickled(t __class__t__mro__R Rt _HEAPTYPERR R t__name__t __getstate__tAttributeErrortgetattrt__dict__R(tselftprotoRRtargstgetstatetdict((s /usr/lib64/python2.7/copy_reg.pyt _reduce_ex;s.         cGs|j||ŒS(N(R(RR)((s /usr/lib64/python2.7/copy_reg.pyt __newobj__\scCs4|jjdƒ}|dk r"|Sg}t|dƒs:nßxÜ|jD]Ñ}d|jkrD|jd}t|tƒr|f}nx‘|D]†}|d kr qˆqˆ|jdƒr|jdƒ r|j j dƒ}|rñ|j d||fƒq|j |ƒqˆ|j |ƒqˆWqDqDWy ||_ 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__t_s_%s%sN(R&R/( R&tgetR R R t isinstancet basestringt startswithtendswithR"tlstriptappendR.(RtnamesRtslotstnametstripped((s /usr/lib64/python2.7/copy_reg.pyt _slotnames_s2       cCsĜt|ƒ}d|ko#dkns4td‚n||f}tj|ƒ|krntj|ƒ|krndS|tkr—td|t|fƒ‚n|tkrÀtd|t|fƒ‚n|t|<|t|s.     !  <