def _should_set_tablename(bases, d):
 if (('__tablename__' in d) or ('__table__' in d) or ('__abstract__' in d)):
  return False
 if any((v.primary_key for v in itervalues(d) if isinstance(v, sqlalchemy.Column))):
  return True
 for base in bases:
  if (hasattr(base, '__tablename__') or hasattr(base, '__table__')):
   return False
  for name in dir(base):
   attr = getattr(base, name)
   if (isinstance(attr, sqlalchemy.Column) and attr.primary_key):
    return True

def _should_set_tablename ( bases , d ) : if ( ( '__tablename__' in d ) or ( '__table__' in d ) or ( '__abstract__' in d ) ) : return False if any ( ( v . primary_key for v in itervalues ( d ) if isinstance ( v , sqlalchemy . Column ) ) ) : return True for base in bases : if ( hasattr ( base , '__tablename__' ) or hasattr ( base , '__table__' ) ) : return False for name in dir ( base ) : attr = getattr ( base , name ) if ( isinstance ( attr , sqlalchemy . Column ) and attr . primary_key ) : return True
check what values are set by a class and its bases to determine if a tablename should be automatically generated .