Your IP : 3.144.4.50


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/copy.cpython-33.pyc

�
��f#c@sydZddlZddlZddlmZddlZGdd�de�ZeZyddl	m
Z
Wnek
r�dZ
YnXdddgZ
d	d�ZiZZd
d�ZxWed�eeeeeeeeeejee�ejejfD]Zeee<q�We edd�Zedk	r;eee<nx9d$D]1Z!e ee!d�Zedk	rBeee<qBqBWdd�Z"x!e#e$e%fD]Ze"ee<q�Wdd�Z&e
dk	r�e&ee
<n[dgdd�Z'iZ(Zdd�Z)e)eed�<e)eee�<e)ee<e)ee<e)ee<ye)ee*<Wne+k
rWYnXe)ee<e)ee<ye)eej,<Wne-k
r�YnXe)ee<e)ee<e)eej<e)eej<e)eej<dd�Z.e.ee#<dd�Z/e/ee<dd�Z0e0ee$<e
dk	r(e0ee
<ndd�Z1e1e(ej2<dd�Z3dd d!�Z4[[Gd"d#�d#�Z5dS(%u�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.
iN(udispatch_tablecBs|EeZdZdS(uErrorN(u__name__u
__module__u__qualname__(u
__locals__((u)/opt/alt/python33/lib64/python3.3/copy.pyuError8suError(uPyStringMapucopyudeepcopycCst|�}tj|�}|r+||�Syt|t�}Wntk
rXd}YnX|rit|�St|dd�}|r�||�St	j|�}|r�||�}n[t|dd�}|r�|d�}n4t|dd�}|r�|�}nt
d|��t||d�S(	ulShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    u__copy__u
__reduce_ex__iu
__reduce__u%un(shallow)copyable object of type %siFN(utypeu_copy_dispatchugetu
issubclassu	TypeErroruFalseu_copy_immutableugetattruNoneudispatch_tableuErroru_reconstruct(uxuclsucopieruisscureductorurv((u)/opt/alt/python33/lib64/python3.3/copy.pyucopyCs0



cCs|S(N((ux((u)/opt/alt/python33/lib64/python3.3/copy.pyu_copy_immutablensu_copy_immutableuCodeTypeucomplexuunicodecCst|�|�S(N(utype(ux((u)/opt/alt/python33/lib64/python3.3/copy.pyu_copy_with_constructor}su_copy_with_constructorcCs
|j�S(N(ucopy(ux((u)/opt/alt/python33/lib64/python3.3/copy.pyu_copy_with_copy_method�su_copy_with_copy_methodc

Cs�|dkri}nt|�}|j||�}||k	rC|St|�}tj|�}|rv|||�}nyt|t�}Wntk
r�d}YnX|r�t||�}n�t|dd�}|r�||�}n�t	j|�}|r||�}	n[t|dd�}|r.|d�}	n4t|dd�}|rR|�}	nt
d|��t||	d|�}||k	r�|||<t||�n|S(	uiDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    iu__deepcopy__u
__reduce_ex__iu
__reduce__u"un(deep)copyable object of type %siN(
uNoneuidugetutypeu_deepcopy_dispatchu
issubclassu	TypeErroru_deepcopy_atomicugetattrudispatch_tableuErroru_reconstructu_keep_alive(
uxumemou_niluduyuclsucopieruisscureductorurv((u)/opt/alt/python33/lib64/python3.3/copy.pyudeepcopy�sF	


cCs|S(N((uxumemo((u)/opt/alt/python33/lib64/python3.3/copy.pyu_deepcopy_atomic�su_deepcopy_atomiccCsAg}||t|�<x$|D]}|jt||��qW|S(N(uiduappendudeepcopy(uxumemouyua((u)/opt/alt/python33/lib64/python3.3/copy.pyu_deepcopy_list�s

u_deepcopy_listcCs�g}x$|D]}|jt||��q
Wy|t|�SWntk
rSYnXxDtt|��D]*}||||k	rgt|�}PqgqgW|}|S(N(uappendudeepcopyuiduKeyErrorurangeulenutuple(uxumemouyuaui((u)/opt/alt/python33/lib64/python3.3/copy.pyu_deepcopy_tuple�s

u_deepcopy_tuplecCsSi}||t|�<x6|j�D](\}}t||�|t||�<q#W|S(N(uiduitemsudeepcopy(uxumemouyukeyuvalue((u)/opt/alt/python33/lib64/python3.3/copy.pyu_deepcopy_dict�s
 u_deepcopy_dictcCs"t|�|jt|j|��S(N(utypeu__func__udeepcopyu__self__(uxumemo((u)/opt/alt/python33/lib64/python3.3/copy.pyu_deepcopy_method�su_deepcopy_methodcCsGy|t|�j|�Wn%tk
rB|g|t|�<YnXdS(uMKeeps 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(uiduappenduKeyError(uxumemo((u)/opt/alt/python33/lib64/python3.3/copy.pyu_keep_alives

u_keep_alivecCsst|t�r|St|t�s(t�|dkr=i}nt|�}|dks[t�|dd�\}}|dkr�|d}ni}|dkr�|d}nd}|dkr�|d}	nd}	|r�t||�}n||�}
|
|t|�<|r�|r t||�}nt|
d�r?|
j	|�q�t|t�rot|�dkro|\}}nd}|dk	r�|
j
j|�n|dk	r�x-|j�D]\}}
t
|
||
�q�Wq�n|dk	rx6|D]+}|rt||�}n|
j|�q�Wn|	dk	roxH|	D]=\}}
|r^t||�}t|
|�}
n|
|
|<q+Wn|
S(Niiiiu__setstate__(iiii(u
isinstanceustrutupleuAssertionErroruNoneulenudeepcopyuiduhasattru__setstate__u__dict__uupdateuitemsusetattruappend(uxuinfoudeepumemounucallableuargsustateulistiterudictiteruyu	slotstateukeyuvalueuitem((u)/opt/alt/python33/lib64/python3.3/copy.pyu_reconstructs\	


!
u_reconstructcBs|EeZdZdS(u_EmptyClassN(u__name__u
__module__u__qualname__(u
__locals__((u)/opt/alt/python33/lib64/python3.3/copy.pyu_EmptyClassLsu_EmptyClass(ucomplexuunicode(6u__doc__utypesuweakrefucopyregudispatch_tableubuiltinsu	ExceptionuErroruerroruorg.python.coreuPyStringMapuImportErroruNoneu__all__ucopyu_copy_dispatchudu_copy_immutableutypeuintufloatuboolustrutupleubytesu	frozenseturangeuBuiltinFunctionTypeuEllipsisuFunctionTypeurefutugetattrunameu_copy_with_constructorulistudictusetu_copy_with_copy_methodudeepcopyu_deepcopy_dispatchu_deepcopy_atomicucomplexu	NameErroruCodeTypeuAttributeErroru_deepcopy_listu_deepcopy_tupleu_deepcopy_dictu_deepcopy_methodu
MethodTypeu_keep_aliveu_reconstructu_EmptyClass(((u)/opt/alt/python33/lib64/python3.3/copy.pyu<module>1s�
)



5

















7

?>