#NEWLINE# def deepcopy( x , memo = None , _nil = [ ] ) : #NEWLINE# #INDENT# "Deep copy operation on arbitrary Python objects.\n\n    See the module's __doc__ string for more info.\n    " #NEWLINE# if ( memo is None ) : #NEWLINE# #INDENT# memo = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# d = id ( x ) #NEWLINE# y = memo . get ( d , _nil ) #NEWLINE# if ( y is not _nil ) : #NEWLINE# #INDENT# return y #NEWLINE# #UNINDENT# cls = type ( x ) #NEWLINE# copier = _deepcopy_dispatch . get ( cls ) #NEWLINE# if copier : #NEWLINE# #INDENT# y = copier ( x , memo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# issc = issubclass ( cls , type ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# issc = 0 #NEWLINE# #UNINDENT# if issc : #NEWLINE# #INDENT# y = _deepcopy_atomic ( x , memo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# copier = getattr ( x , '__deepcopy__' , None ) #NEWLINE# if copier : #NEWLINE# #INDENT# y = copier ( memo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reductor = dispatch_table . get ( cls ) #NEWLINE# if reductor : #NEWLINE# #INDENT# rv = reductor ( x ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reductor = getattr ( rv , '__reduce_ex__' , None ) #NEWLINE# if reductor : #NEWLINE# #INDENT# rv = reductor ( 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reductor = getattr ( x , '__reduce__' , None ) #NEWLINE# if reductor : #NEWLINE# #INDENT# rv = reductor ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Error ( ( 'un(deep)copyable object of type %s' % cls ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# y = _reconstruct ( x , rv , 1 , memo ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( y is not x ) : #NEWLINE# #INDENT# memo [ d ] = y #NEWLINE# _keep_alive ( x , memo ) #NEWLINE# #UNINDENT# return y