prof_api/helper_functions.py
def find_name(professor):
    """
    Takes a name from webpage and makes it possible to query in the database

    :param professor: name of professor in dash form
    :return: name of professor used for querying database and '' if not found
    """
    name = professor.split('-')
    query = 'SELECT name FROM professor WHERE name LIKE ?;'

    conn = sqlite3.connect(app.config['DATABASE_NAME'])
    cur = conn.cursor()
    all_prof_names = cur.execute(query, ['%{}%'.format(name[0])]).fetchall()
    for prof_name in all_prof_names:
        cut_prof_name = re.sub('[-, ]', '', prof_name[0])
        if cut_prof_name.lower() == ''.join(name).lower():
            return prof_name[0]
    return ''

    Takes a name from webpage and makes it possible to query in the database

    :param professor: name of professor in dash form
    :return: name of professor used for querying database and '' if not found
    
Takes a name from webpage and makes it possible to query in the database
Takes a name from webpage and makes it possible to query in the database
def find_name(professor):
    name = professor.split('-')
    query = 'SELECT name FROM professor WHERE name LIKE ?;'
    conn = sqlite3.connect(app.config['DATABASE_NAME'])
    cur = conn.cursor()
    all_prof_names = cur.execute(query, ['%{}%'.format(name[0])]).fetchall()
    for prof_name in all_prof_names:
        cut_prof_name = re.sub('[-, ]', '', prof_name[0])
        if cut_prof_name.lower() == ''.join(name).lower():
            return prof_name[0]
    return ''
def find_name ( professor ) : name = professor . split ( '-' ) query = 'SELECT name FROM professor WHERE name LIKE ?;' conn = sqlite3 . connect ( app . config [ 'DATABASE_NAME' ] ) cur = conn . cursor ( ) all_prof_names = cur . execute ( query , [ '%{}%' . format ( name [ 0 ] ) ] ) . fetchall ( ) for prof_name in all_prof_names : cut_prof_name = re . sub ( '[-, ]' , '' , prof_name [ 0 ] ) if cut_prof_name . lower ( ) == '' . join ( name ) . lower ( ) : return prof_name [ 0 ] return ''
Takes a name from webpage and makes it possible to query in the database
Takes a name from webpage and makes it possible to query in the database
"""
    Takes a name from webpage and makes it possible to query in the database

    :param professor: name of professor in dash form
    :return: name of professor used for querying database and '' if not found
    """
name of professor used for querying database and '' if not found
name of professor used for querying database and ' ' if not found
professor
name of professor in dash form
name of professor in dash form