def working_dir(path):
    """
    Change working directory within a context::

        >>> import os
        >>> from cqparts.utils import working_dir

        >>> print(os.getcwd())
        /home/myuser/temp

        >>> with working_dir('..'):
        ...     print(os.getcwd())
        ...
        /home/myuser

    :param path: working path to use while in context
    :type path: :class:`str`
    """
    initial_path = os.getcwd()
    os.chdir(path)
    yield
    os.chdir(initial_path)
def working_dir ( path ) : initial_path = os . getcwd ( ) os . chdir ( path ) yield os . chdir ( initial_path )
Change working directory within a context::

        >>> import os
        >>> from cqparts.utils import working_dir

        >>> print(os.getcwd())
        /home/myuser/temp

        >>> with working_dir('..'):
        ...     print(os.getcwd())
        ...
        /home/myuser

    :param path: working path to use while in context
    :type path: :class:`str`