Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/
Upload File :
Current File : //usr/lib/python2.7/copy_reg.pyc


|_c@sdZddlmZdddddgZiZddZd	Zye	Wne
k
ranXd
Zee	ee	dZdZ
dZdZdZiZiZiZdZdZdZdS(sHelper 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	ClassTypetpickletconstructort
add_extensiontremove_extensiontclear_extension_cachecCsft|tkr!tdnt|ds?tdn|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/lib/python2.7/copy_reg.pyRs
cCs"t|dstdndS(NRsconstructors must be callable(R
R	(tobject((s/usr/lib/python2.7/copy_reg.pyRscCst|j|jffS(N(tcomplextrealtimag(tc((s/usr/lib/python2.7/copy_reg.pytpickle_complex'scCsY|tkrtj|}n7|j||}|jtjkrU|j||n|S(N(Rt__new__t__init__(tclstbasetstatetobj((s/usr/lib/python2.7/copy_reg.pyt_reconstructor.sii	cCs8|dkstx;|jjD]'}t|dr|jt@rPqqWt}|tkred}n.||jkrtd|j	n||}|j||f}y
|j
}WnYtk
r
t|ddrtdny
|j
}Wqtk
r	d}qXn
X|}|r*t||fSt|fSdS(Nit	__flags__scan't pickle %s objectst	__slots__sNa class that defines __slots__ without defining __getstate__ cannot be pickled(tAssertionErrort	__class__t__mro__R
Rt	_HEAPTYPERRR	t__name__t__getstate__tAttributeErrortgetattrt__dict__R(tselftprotoRRtargstgetstatetdict((s/usr/lib/python2.7/copy_reg.pyt
_reduce_ex;s0	



	
cGs|j||S(N(R(RR*((s/usr/lib/python2.7/copy_reg.pyt
__newobj__\scCs|jjd}|dk	r"|Sg}t|ds:nx|jD]}d|jkrD|jd}t|tr|f}nxl|D]a}|dkrqq|jdr|jdr|j	d|j
|fq|j	|qWqDqDWy
||_WnnX|S(	sReturn 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
R!t
isinstancet
basestringt
startswithtendswithtappendR#R/(RtnamesRtslotstname((s/usr/lib/python2.7/copy_reg.pyt
_slotnames_s,


cCst|}d|ko#dkns4tdn||f}tj||krntj||krndS|tkrtd|t|fn|tkrtd|t|fn|t|<|t|<dS(sRegister an extension code.iiscode out of rangeNs)key %s is already registered with code %ss$code %s is already in use for key %s(tintt
ValueErrort_extension_registryR2t_inverted_registry(tmoduleR:tcodetkey((s/usr/lib/python2.7/copy_reg.pyRs
cCsw||f}tj||ks6tj||krOtd||fnt|=t|=|tkrst|=ndS(s0Unregister an extension code.  For testing only.s%key %s is not registered with code %sN(R>R2R?R=t_extension_cache(R@R:RARB((s/usr/lib/python2.7/copy_reg.pyRscCstjdS(N(RCtclear(((s/usr/lib/python2.7/copy_reg.pyRsNi(t__doc__ttypesRRt__all__RRRRRt	NameErrorRRR"R-R.R;R>R?RCRRR(((s/usr/lib/python2.7/copy_reg.pyt<module>s.
	
				!		8