Module Expr Str ImportFrom alias alias alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args defaults body Expr Str Assign NameStore Call NameLoad Expr Yield NameLoad Expr Call NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Yield NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Expr Yield NameLoad Return Expr Call AttributeLoad NameLoad attr NameLoad Expr Yield NameLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list NameLoad
N/A N/A  Contexts for *with* statement providing temporary directories
 __future__ division print_function absolute_import N/A os contextlib contextmanager shutil rmtree tempfile mkdtemp tempdir N/A N/A N/A N/A N/A Create and return a temporary directory.  This has the same
    behavior as mkdtemp but can be used as a context manager.

    Upon exiting the context, the directory and everthing contained
    in it are removed.

    Examples
    --------
    >>> import os
    >>> with tempdir() as tmpdir:
    ...     fname = os.path.join(tmpdir, 'example_file.txt')
    ...     with open(fname, 'wt') as fobj:
    ...         _ = fobj.write('a string\n')
    >>> os.path.exists(tmpdir)
    False
     N/A d N/A mkdtemp N/A N/A d N/A N/A rmtree d N/A contextmanager in_tempdir N/A N/A N/A N/A N/A  Create, return, and change directory to a temporary directory

    Examples
    --------
    >>> import os
    >>> my_cwd = os.getcwd()
    >>> with in_tempdir() as tmpdir:
    ...     _ = open('test.txt', 'wt').write('some text')
    ...     assert os.path.isfile('test.txt')
    ...     assert os.path.isfile(os.path.join(tmpdir, 'test.txt'))
    >>> os.path.exists(tmpdir)
    False
    >>> os.getcwd() == my_cwd
    True
     N/A pwd N/A N/A os getcwd N/A d N/A mkdtemp N/A N/A N/A os chdir d N/A N/A d N/A N/A N/A os chdir pwd N/A N/A rmtree d N/A contextmanager in_dir N/A N/A dir N/A None N/A N/A  Change directory to given directory for duration of ``with`` block

    Useful when you want to use `in_tempdir` for the final test, but
    you are still debugging.  For example, you may want to do this in the end:

    >>> with in_tempdir() as tmpdir:
    ...     # do something complicated which might break
    ...     pass

    But indeed the complicated thing does break, and meanwhile the
    ``in_tempdir`` context manager wiped out the directory with the
    temporary files that you wanted for debugging.  So, while debugging, you
    replace with something like:

    >>> with in_dir() as tmpdir: # Use working directory by default
    ...     # do something complicated which might break
    ...     pass

    You can then look at the temporary file outputs to debug what is happening,
    fix, and finally replace ``in_dir`` with ``in_tempdir`` again.
     N/A cwd N/A N/A os getcwd N/A N/A dir None N/A N/A N/A cwd N/A N/A N/A N/A os chdir dir N/A N/A dir N/A N/A N/A os chdir cwd N/A contextmanager