Your IP : 18.223.108.134


Current Path : /opt/alt/python27/lib64/python2.7/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/copy.pyo

�
^
bc@s�dZddlZddlZddlmZdefd��YZeZyddlm	Z	Wne
k
rwdZ	nXdddgZd	�Z
iZZd
�Zx]ed�eeeeeeeeeejejee�ejejfD]Zeee<q�Wx9dD]1Z e!ee d�Zedk	r
eee<q
q
Wd�Z"x!e#e$e%fD]Ze"ee<qXWd�Z&e	dk	r�e&ee	<nd�Z'e'eej(<[dgd�Z)iZ*Zd�Z+e+eed�<e+eee�<e+ee<e+ee<e+ee<e+ee<ye+ee,<Wne-k
r2nXe+ee<ye+ee.<Wne-k
r^nXye+eej/<Wne0k
r�nXe+ee<e+ee<e+eej<e+eej<e+eej<e+eej<d�Z1e1ee#<d�Z2e2ee<d�Z3e3ee$<e	dk	re3ee	<nd�Z4e4e*ej5<d�Z6d�Z7e7eej(<dd�Z8[[ddd��YZ9d�Z:e;dkr�e:�ndS( s�Generic (shallow and deep) copying operations.

Interface summary:

        import copy

        x = copy.copy(y)        # make a shallow copy of y
        x = copy.deepcopy(y)    # make a deep copy of y

For module specific errors, copy.Error is raised.

The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).

- A shallow copy constructs a new compound object and then (to the
  extent possible) inserts *the same objects* into it that the
  original contains.

- A deep copy constructs a new compound object and then, recursively,
  inserts *copies* into it of the objects found in the original.

Two problems often exist with deep copy operations that don't exist
with shallow copy operations:

 a) recursive objects (compound objects that, directly or indirectly,
    contain a reference to themselves) may cause a recursive loop

 b) because deep copy copies *everything* it may copy too much, e.g.
    administrative data structures that should be shared even between
    copies

Python's deep copy operation avoids these problems by:

 a) keeping a table of objects already copied during the current
    copying pass

 b) letting user-defined classes override the copying operation or the
    set of components copied

This version does not copy types like module, class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types.

Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called __getinitargs__(),
__getstate__() and __setstate__().  See the documentation for module
"pickle" for information on these methods.
i����N(tdispatch_tabletErrorcBseZRS((t__name__t
__module__(((s)/opt/alt/python27/lib64/python2.7/copy.pyR7s(tPyStringMaptcopytdeepcopycCs�t|�}tj|�}|r+||�St|dd�}|rM||�Stj|�}|rq||�}n[t|dd�}|r�|d�}n4t|dd�}|r�|�}ntd|��t||d�S(slShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    t__copy__t
__reduce_ex__it
__reduce__s%un(shallow)copyable object of type %siN(ttypet_copy_dispatchtgettgetattrtNoneRRt_reconstruct(txtclstcopiertreductortrv((s)/opt/alt/python27/lib64/python2.7/copy.pyRBs$

cCs|S(N((R((s)/opt/alt/python27/lib64/python2.7/copy.pyt_copy_immutableestComplexTypetUnicodeTypetCodeTypecCst|�|�S(N(R
(R((s)/opt/alt/python27/lib64/python2.7/copy.pyt_copy_with_constructorqscCs
|j�S(N(R(R((s)/opt/alt/python27/lib64/python2.7/copy.pyt_copy_with_copy_methodvscCs�t|d�r|j�St|d�rF|j�}|j|�}nt�}|j|_t|d�ry|j�}n	|j}t|d�r�|j|�n|jj|�|S(NRt__getinitargs__t__getstate__t__setstate__(	thasattrRRt	__class__t_EmptyClassRt__dict__Rtupdate(Rtargstytstate((s)/opt/alt/python27/lib64/python2.7/copy.pyt
_copy_inst{s
		c
Cs�|dkri}nt|�}|j||�}||k	rC|St|�}tj|�}|rv|||�}nyt|t�}Wntk
r�d}nX|r�t||�}n�t|dd�}|r�||�}n�t	j|�}|r||�}	n[t|dd�}|r-|d�}	n4t|dd�}|rQ|�}	nt
d|��t||	d|�}|||<t||�|S(	siDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    it__deepcopy__RiR	s"un(deep)copyable object of type %siN(
RtidRR
t_deepcopy_dispatcht
issubclasst	TypeErrort_deepcopy_atomicR
RRRt_keep_alive(
Rtmemot_niltdR$RRtisscRR((s)/opt/alt/python27/lib64/python2.7/copy.pyR�sD	




cCs|S(N((RR.((s)/opt/alt/python27/lib64/python2.7/copy.pyR,�scCsAg}||t|�<x$|D]}|jt||��qW|S(N(R(tappendR(RR.R$ta((s)/opt/alt/python27/lib64/python2.7/copy.pyt_deepcopy_list�s

cCs�g}x$|D]}|jt||��q
Wt|�}y||SWntk
rXnXxDtt|��D]*}||||k	rlt|�}PqlqlW|}|||<|S(N(R2RR(tKeyErrortrangetlenttuple(RR.R$R3R0ti((s)/opt/alt/python27/lib64/python2.7/copy.pyt_deepcopy_tuple�s


cCsSi}||t|�<x6|j�D](\}}t||�|t||�<q#W|S(N(R(t	iteritemsR(RR.R$tkeytvalue((s)/opt/alt/python27/lib64/python2.7/copy.pyt_deepcopy_dict�s
 cCs(t|�|jt|j|�|j�S(N(R
tim_funcRtim_selftim_class(RR.((s)/opt/alt/python27/lib64/python2.7/copy.pyt_deepcopy_methodscCsFy|t|�j|�Wn$tk
rA|g|t|�<nXdS(sMKeeps 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(R(R2R5(RR.((s)/opt/alt/python27/lib64/python2.7/copy.pyR-s

cCs�t|d�r|j|�St|d�rX|j�}t||�}|j|�}nt�}|j|_||t|�<t|d�r�|j�}n	|j}t||�}t|d�r�|j	|�n|jj
|�|S(NR'RRR(RR'RRRR R(RR!RR"(RR.R#R$R%((s)/opt/alt/python27/lib64/python2.7/copy.pyt_deepcopy_insts"
		cCsLt|t�r|S|dkr(i}nt|�}|d \}}|dkr]|d}nd}|dkr||d}nd}|dkr�|d}	nd}	|r�t||�}n||�}
|
|t|�<|dk	r�|r�t||�}nt|
d�r|
j|�q�t|t�rHt|�dkrH|\}}nd}|dk	rm|
j	j
|�n|dk	r�x-|j�D]\}}
t|
||
�q�Wq�n|dk	r�x6|D]+}|r�t||�}n|
j
|�q�Wn|	dk	rHxH|	D]=\}}
|r7t||�}t|
|�}
n|
|
|<qWn|
S(NiiiR(t
isinstancetstrRR7RR(RRR8R!R"R;tsetattrR2(RtinfotdeepR.tntcallableR#R%tlistitertdictiterR$t	slotstateR<R=titem((s)/opt/alt/python27/lib64/python2.7/copy.pyR2sX	


!
R cBseZRS((RR(((s)/opt/alt/python27/lib64/python2.7/copy.pyR nsc
Cs	ddddddddgidd6dgig}t|�}||kGHtt|�}||kGHt|�}||kGHddd��Y}|d	�}|j|�t|�}||kGH|GH|GHt|�}||kGH|GH|GH|ji||d6|d
d6�t|�}ddl}t|j|�GHt|j|�GHt|j|�GHt|j|�GHt|�}ddl}t|j|�GHt|j|�GHt|j|�GHt|j|�GHd
tfd��Y}|idd6�}t|�}	||	fGHdS(Nilg��Q�	@txyzzytabctABCtCcBs2eZdd�Zd�Zd�Zdd�ZRS(cSs`d|_||_tdkr:ddl}|jd}nt}t|�|_|jj�dS(Nit__main__i����i(	R3targRtsystargvt__file__topentfptclose(tselfRTRUtfile((s)/opt/alt/python27/lib64/python2.7/copy.pyt__init__{s		cSsi|jd6|jd6S(NR3RT(R3RT(R[((s)/opt/alt/python27/lib64/python2.7/copy.pyR�scSs1x*|j�D]\}}t|||�q
WdS(N(R;RF(R[R%R<R=((s)/opt/alt/python27/lib64/python2.7/copy.pyR�scSs+|jt|j|��}|j|_|S(N(RRRTR3(R[R.tnew((s)/opt/alt/python27/lib64/python2.7/copy.pyR'�sN(RRRR]RRR'(((s)/opt/alt/python27/lib64/python2.7/copy.pyRRzs
		sargument sketchitxyzi����todictcBseZid�Zd�ZRS(cSsd|_tj||�dS(Nic(R3tdictR](R[R0((s)/opt/alt/python27/lib64/python2.7/copy.pyR]�s	cSstj|||�|jdS(N(Rat__setitem__R3(R[tkR9((s)/opt/alt/python27/lib64/python2.7/copy.pyRb�s(RRR]Rb(((s)/opt/alt/python27/lib64/python2.7/copy.pyR`�stBtA(il(((RRtmapRR2treprRa(
tltl1RRtctl2tl3RgR`toR((s)/opt/alt/python27/lib64/python2.7/copy.pyt_testqsH
#RS(RRR((<t__doc__ttypestweakreftcopy_regRt	ExceptionRterrortorg.python.coreRtImportErrorRt__all__RRR0RR
tinttlongtfloattboolRER8t	frozensettxranget	ClassTypetBuiltinFunctionTypetEllipsistFunctionTypetreftttnameR
RtlistRatsetRR&tInstanceTypeRR)R,tcomplext	NameErrortunicodeRtAttributeErrorR4R:R>RBt
MethodTypeR-RCRR RnR(((s)/opt/alt/python27/lib64/python2.7/copy.pyt<module>1s�

	!
	
		
	
3
	













	
	
	

	
		
7	?

?>