@contextmanager
def printoptions(*args, **kwds):
    '\n    Context manager for setting numpy print options.\n\n    Set print options for the scope of the `with` block, and restore the old\n    options at the end. See `numpy.set_printoptions` for the full description of\n    available options. If any invalid options are specified, they will be ignored.\n\n    >>> with printoptions(precision=2):\n    ...     print(np.array([2.0])) / 3\n    [0.67]\n    The `as`-clause of the `with`-statement gives the current print options:\n    >>> with printoptions(precision=2) as opts:\n    ...      assert_equal(opts, np.get_printoptions())\n\n    Parameters\n    ----------\n    *args : list\n        Variable-length argument list.\n    **kwds : dict\n        Arbitrary keyword arguments.\n\n    Yields\n    ------\n    str or int\n\n    See Also\n    --------\n        set_printoptions, get_printoptions\n    '
    opts = np.get_printoptions()
    kw_opts = dict(((key, val) for (key, val) in kwds.items() if (key in opts)))
    try:
        np.set_printoptions(*args, **kw_opts)
        (yield np.get_printoptions())
    finally:
        np.set_printoptions(**opts)
Context manager for setting numpy print options.

Set print options for the scope of the `with` block, and restore the old
options at the end. See `numpy.set_printoptions` for the full description of
available options. If any invalid options are specified, they will be ignored.

>>> with printoptions(precision=2):
...     print(np.array([2.0])) / 3
[0.67]
The `as`-clause of the `with`-statement gives the current print options:
>>> with printoptions(precision=2) as opts:
...      assert_equal(opts, np.get_printoptions())

Parameters
----------
*args : list
    Variable-length argument list.
**kwds : dict
    Arbitrary keyword arguments.

Yields
------
str or int

See Also
--------
    set_printoptions, get_printoptions
@contextmanager
def printoptions(*args, **kwds):
    '\n    Context manager for setting numpy print options.\n\n    Set print options for the scope of the `with` block, and restore the old\n    options at the end. See `numpy.set_printoptions` for the full description of\n    available options. If any invalid options are specified, they will be ignored.\n\n    >>> with printoptions(precision=2):\n    ...     print(np.array([2.0])) / 3\n    [0.67]\n    The `as`-clause of the `with`-statement gives the current print options:\n    >>> with printoptions(precision=2) as opts:\n    ...      assert_equal(opts, np.get_printoptions())\n\n    Parameters\n    ----------\n    *args : list\n        Variable-length argument list.\n    **kwds : dict\n        Arbitrary keyword arguments.\n\n    Yields\n    ------\n    str or int\n\n    See Also\n    --------\n        set_printoptions, get_printoptions\n    '
    opts = np.get_printoptions()
    kw_opts = dict(((key, val) for (key, val) in kwds.items() if (key in opts)))
    try:
        np.set_printoptions(*args, **kw_opts)
        (yield np.get_printoptions())
    finally:
        np.set_printoptions(**opts)