def get_dbname(sockfile):
 if (sockfile in DEFAULT_SOCKFILES):
  return 'default'
 m = re.search('/mysql-(.+)/[^.]+\\.sock$', sockfile)
 if (not m):
  utils.err(("error: couldn't guess the name of the DB for " + sockfile))
  return None
 return m.group(1)

def get_dbname ( sockfile ) : if ( sockfile in DEFAULT_SOCKFILES ) : return 'default' m = re . search ( '/mysql-(.+)/[^.]+\\.sock$' , sockfile ) if ( not m ) : utils . err ( ( "error: couldn't guess the name of the DB for " + sockfile ) ) return None return m . group ( 1 )
returns the name of the db based on the path to the socket file .