@contextlib.contextmanager
def cd(newpath):
    """
    Change the current working directory to `newpath`, temporarily.

    If the old current working directory no longer exists, do not return back.
    """
    oldpath = os.getcwd()
    os.chdir(newpath)
    try:
        yield
    finally:
        try:
            os.chdir(oldpath)
        except __HOLE__:
            # If oldpath no longer exists, stay where we are.
            pass

# Check Sphinx version
dataset/ETHPy150Open networkx/networkx/doc/source/conf.py/cd