(table_name_wildcard, separator)
return matching_tables
Find tables to restore
Find tables to restore
Find tables to restore
def get_restore_table_matches(table_name_wildcard, separator):
    """
    Find tables to restore
    """

    matching_tables = []
    try:
        dir_list = os.listdir("./" + args.dumpPath)
    except OSError:
        logging.info(
            'Cannot find "./%s", Now trying user provided absolute dump path..'
            % args.dumpPath
        )
        try:
            dir_list = os.listdir(args.dumpPath)
        except OSError:
            logging.info(
                'Cannot find "%s", Now trying current working directory..'
                % args.dumpPath
            )
            dump_data_path = CURRENT_WORKING_DIR
            try:
                dir_list = os.listdir(dump_data_path)
            except OSError:
                logging.info(
                    'Cannot find "%s" directory containing dump files!' % dump_data_path
                )
                sys.exit(1)

    for dir_name in dir_list:
        if table_name_wildcard == "*":
            matching_tables.append(dir_name)
        elif separator == "":

            if dir_name.startswith(
                re.sub(
                    r"([A-Z])", r" \1", table_name_wildcard.split("*", 1)[0]
                ).split()[0]
            ):
                matching_tables.append(dir_name)
        elif dir_name.split(separator, 1)[0] == table_name_wildcard.split("*", 1)[0]:
            matching_tables.append(dir_name)

    return matching_tables
def get_restore_table_matches ( table_name_wildcard , separator ) : matching_tables = [ ] try : dir_list = os . listdir ( "./" + args . dumpPath ) except OSError : logging . info ( 'Cannot find "./%s", Now trying user provided absolute dump path..' % args . dumpPath ) try : dir_list = os . listdir ( args . dumpPath ) except OSError : logging . info ( 'Cannot find "%s", Now trying current working directory..' % args . dumpPath ) dump_data_path = CURRENT_WORKING_DIR try : dir_list = os . listdir ( dump_data_path ) except OSError : logging . info ( 'Cannot find "%s" directory containing dump files!' % dump_data_path ) sys . exit ( 1 ) for dir_name in dir_list : if table_name_wildcard == "*" : matching_tables . append ( dir_name ) elif separator == "" : if dir_name . startswith ( re . sub ( r"([A-Z])" , r" \1" , table_name_wildcard . split ( "*" , 1 ) [ 0 ] ) . split ( ) [ 0 ] ) : matching_tables . append ( dir_name ) elif dir_name . split ( separator , 1 ) [ 0 ] == table_name_wildcard . split ( "*" , 1 ) [ 0 ] : matching_tables . append ( dir_name ) return matching_tables