from pathlib import Path


def read_final(path: Path) -> str:
    """
    Repeatedly read the file until it is non-empty.

    Some notebook editors empty the source file before updating it.
    """
    contents = ''
    while len(contents) == 0:
        with path.open() as file:
            contents = file.read()
    return contents