@contextmanager
def alt_file(current_file):
    """
    Create an alternate file next to an existing file.
    """
    _alt_file = current_file + '-alt'
    yield _alt_file
    try:
        shutil.move(_alt_file, current_file)
    except __HOLE__:
        # We didn't use an alt file.
        pass
dataset/ETHPy150Open koenbok/Cactus/cactus/utils/filesystem.py/alt_file