ok

Mini Shell

Direktori : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/copy.cpython-36.pyc

3


 \o"�@sjdZddlZddlZddlmZGdd�de�ZeZyddlm	Z	Wne
k
r\dZ	YnXdddgZd	d�ZiZ
Zd
d�ZxHed�eeeeeeeeeeeejee�ee�ejejfD]Z eee <q�We!edd�Z e dk	r�eee <e"jee"<e#jee#<e$jee$<e%jee%<e	dk	�r"e	jee	<[[ dgfd
d�Z&iZ'Zdd�Z(e(eed�<e(eee�<e(eee�<e(ee<e(ee<e(ee<e(ee<e(ee<e(ee<ye(eej)<Wne*k
�r�YnXe(ee<e(eej<e(eej<e(eej<e&fdd�Z+e+ee"<e&fdd�Z,e,ee<e&fdd�Z-e-ee#<e	dk	�r2e-ee	<dd�Z.e.eej/<[dd�Z0ddde&fdd�Z1[[[	dS)a�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.
�N)�dispatch_tablec@seZdZdS)�ErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/copy.pyr7sr)�PyStringMap�copy�deepcopycCs�t|�}tj|�}|r||�Syt|t�}Wntk
rDd}YnX|rRt|�St|dd�}|rj||�Stj|�}|r�||�}n>t|dd�}|r�|d�}n$t|dd�}|r�|�}ntd|��t	|t
�r�|St|df|��S)zlShallow copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    F�__copy__N�
__reduce_ex__��
__reduce__z%un(shallow)copyable object of type %s)�type�_copy_dispatch�get�
issubclass�	TypeError�_copy_immutable�getattrrr�
isinstance�str�_reconstruct)�x�cls�copier�issc�reductor�rvrrrr
Bs4





cCs|S)Nr)rrrrrosr�CodeTypec
Cs8|dkri}t|�}|j||�}||k	r,|St|�}tj|�}|rN|||�}n�yt|t�}Wntk
rtd}YnX|r�t||�}n�t|dd�}|r�||�}nxtj|�}|r�||�}	n>t|dd�}|r�|d�}	n$t|dd�}|r�|�}	nt	d|��t
|	t��r|}nt||f|	��}||k	�r4|||<t
||�|S)ziDeep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
    Nr�__deepcopy__r
rrz"un(deep)copyable object of type %s)�idrr�_deepcopy_dispatchrr�_deepcopy_atomicrrrrrr�_keep_alive)
r�memoZ_nil�d�yrrrrrrrrr�sJ








cCs|S)Nr)rr&rrrr$�sr$cCs6g}||t|�<|j}x|D]}||||��qW|S)N)r"�append)rr&rr(r)�arrr�_deepcopy_list�s
r+csh��fdd�|D�}y�t|�Stk
r4YnXx,t||�D]\}}||k	rBt|�}PqBW|}|S)Ncsg|]}�|���qSrr)�.0r*)rr&rr�
<listcomp>�sz#_deepcopy_tuple.<locals>.<listcomp>)r"�KeyError�zip�tuple)rr&rr(�k�jr)rr&r�_deepcopy_tuple�sr3cCs>i}||t|�<x(|j�D]\}}|||�||||�<qW|S)N)r"�items)rr&rr(�key�valuerrr�_deepcopy_dict�s
r7cCst|�|jt|j|��S)N)r�__func__r�__self__)rr&rrr�_deepcopy_method�sr:cCs>y|t|�j|�Wn"tk
r8|g|t|�<YnXdS)aMKeeps 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"r)r.)rr&rrrr%�s
r%csx�dk	}|r$|r$��fdd�|D�}||�}	|r<|	�t|�<|dk	r�|rR�|��}t|	d�rh|	j|�nbt|t�r�t|�dkr�|\}}
nd}
|dk	r�|	jj|�|
dk	r�x |
j�D]\}}t	|	||�q�W|dk	�r|r�x<|D]}
�|
��}
|	j
|
�q�Wnx|D]}
|	j
|
��qW|dk	�rt|�rXxL|D]&\}}�|��}�|��}||	|<�q,Wnx|D]\}}||	|<�q^W|	S)Nc3s|]}�|��VqdS)Nr)r,�arg)rr&rr�	<genexpr>sz_reconstruct.<locals>.<genexpr>�__setstate__�)r"�hasattrr=rr0�len�__dict__�updater4�setattrr))rr&�func�args�stateZlistiterZdictiterrZdeepr(Z	slotstater5r6�itemr)rr&rrsF









r)2�__doc__�types�weakref�copyregr�	Exceptionr�errorZorg.python.corer	�ImportError�__all__r
rr'rr�int�float�bool�complexrr0�bytes�	frozenset�range�slice�BuiltinFunctionType�Ellipsis�NotImplemented�FunctionType�ref�tr�list�dict�set�	bytearrayrr#r$r �AttributeErrorr+r3r7r:�
MethodTyper%rrrrr�<module>1s~

+






8




+

Zerion Mini Shell 1.0