def deconstructible(*args, **kwargs):
 path = kwargs.pop('path', None)
 def decorator(klass):
  def __new__(cls, *args, **kwargs):
   obj = super(klass, cls).__new__(cls)
   obj._constructor_args = (args, kwargs)
   return obj
  def deconstruct(obj):
   '\n            Returns a 3-tuple of class import path, positional arguments,\n            and keyword arguments.\n            '
   if path:
    (module_name, _, name) = path.rpartition('.')
   else:
    module_name = obj.__module__
    name = obj.__class__.__name__
   module = import_module(module_name)
   if (not hasattr(module, name)):
    raise ValueError(('Could not find object %s in %s.\nPlease note that you cannot serialize things like inner classes. Please move the object into the main module body to use migrations.\nFor more information, see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values' % (name, module_name, get_docs_version())))
   return ((path or ('%s.%s' % (obj.__class__.__module__, name))), obj._constructor_args[0], obj._constructor_args[1])
  klass.__new__ = staticmethod(__new__)
  klass.deconstruct = deconstruct
  return klass
 if (not args):
  return decorator
 return decorator(*args, **kwargs)

def deconstructible ( * args , ** kwargs ) : path = kwargs . pop ( 'path' , None ) def decorator ( klass ) : def __new__ ( cls , * args , ** kwargs ) : obj = super ( klass , cls ) . __new__ ( cls ) obj . _constructor_args = ( args , kwargs ) return obj def deconstruct ( obj ) : if path : ( module_name , _ , name ) = path . rpartition ( '.' ) else : module_name = obj . __module__ name = obj . __class__ . __name__ module = import_module ( module_name ) if ( not hasattr ( module , name ) ) : raise ValueError ( ( 'Could not find object %s in %s.\nPlease note that you cannot serialize things like inner classes. Please move the object into the main module body to use migrations.\nFor more information, see https://docs.djangoproject.com/en/%s/topics/migrations/#serializing-values' % ( name , module_name , get_docs_version ( ) ) ) ) return ( ( path or ( '%s.%s' % ( obj . __class__ . __module__ , name ) ) ) , obj . _constructor_args [ 0 ] , obj . _constructor_args [ 1 ] ) klass . __new__ = staticmethod ( __new__ ) klass . deconstruct = deconstruct return klass if ( not args ) : return decorator return decorator ( * args , ** kwargs )
class decorator that allow the decorated class to be serialized by the migrations subsystem .