<commit_before>import glob

from .exceptions import RestoreError
from .settings import BACKUP_DIR, BACKUP_TIMESTAMP_PATTERN


def get_latest_timestamped_file(ext):
    """
    Gets the latest timestamped backup file name with the given database type
    extension.
    """
    # Make glob pattern
    pattern = '{dir}/{pattern}.{ext}.gz'.format(
        dir=BACKUP_DIR,
        pattern=BACKUP_TIMESTAMP_PATTERN,
        ext=ext,
    )

    # Find files
    l = glob.glob(pattern)
    l.sort()
    l.reverse()

    if not l:
        raise RestoreError("No backups found matching '{0}' pattern".format(pattern))

    return l[0]<commit_msg>Comments<commit_after>import glob

from .exceptions import RestoreError
from .settings import BACKUP_DIR, BACKUP_TIMESTAMP_PATTERN


def get_latest_timestamped_file(ext):
    """
    Gets the latest timestamped backup file name with the given database type
    extension.
    """
    pattern = '{dir}/{pattern}.{ext}.gz'.format(
        dir=BACKUP_DIR,
        pattern=BACKUP_TIMESTAMP_PATTERN,
        ext=ext,
    )

    l = glob.glob(pattern)
    l.sort()
    l.reverse()

    if not l:
        raise RestoreError("No backups found matching '{0}' pattern".format(pattern))

    return l[0]
{'fraction_non_alphanumeric': 0.1008130081300813, 'fraction_numerical': 0.0032520325203252032, 'mean_word_length': 3.049342105263158, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7450829', 'n_tokens_mistral': 394, 'n_tokens_neox': 378, 'n_words': 98}