def declarative_base(bind=None, metadata=None, mapper=None, cls=object, name='Base', constructor=_declarative_constructor, class_registry=None, metaclass=DeclarativeMeta):
 lcl_metadata = (metadata or MetaData())
 if bind:
  lcl_metadata.bind = bind
 if (class_registry is None):
  class_registry = weakref.WeakValueDictionary()
 bases = (((not isinstance(cls, tuple)) and (cls,)) or cls)
 class_dict = dict(_decl_class_registry=class_registry, metadata=lcl_metadata)
 if isinstance(cls, type):
  class_dict['__doc__'] = cls.__doc__
 if constructor:
  class_dict['__init__'] = constructor
 if mapper:
  class_dict['__mapper_cls__'] = mapper
 return metaclass(name, bases, class_dict)

def declarative_base ( bind = None , metadata = None , mapper = None , cls = object , name = 'Base' , constructor = _declarative_constructor , class_registry = None , metaclass = DeclarativeMeta ) : lcl_metadata = ( metadata or MetaData ( ) ) if bind : lcl_metadata . bind = bind if ( class_registry is None ) : class_registry = weakref . WeakValueDictionary ( ) bases = ( ( ( not isinstance ( cls , tuple ) ) and ( cls , ) ) or cls ) class_dict = dict ( _decl_class_registry = class_registry , metadata = lcl_metadata ) if isinstance ( cls , type ) : class_dict [ '__doc__' ] = cls . __doc__ if constructor : class_dict [ '__init__' ] = constructor if mapper : class_dict [ '__mapper_cls__' ] = mapper return metaclass ( name , bases , class_dict )
construct a base class for declarative class definitions .