ipython/ipython — pull request #4866 by y-p (2014-01-24 19:39:31+00:00)
Title: ipython_directive now accepts okexcept as an option

Continuing #4803 in trying to get ipython_directive tweaks made in pandas upstream,
this patch adds support for the `:okexcept:` option.

Ocassionaly in docs you want to demonstrate to the reader that a code example
raises an exception. Currently, any exception raised while rendering an ipython_directive
cell bubbles up to stderr when building the docs with sphinx, even though in these
cases the "error" raised is intentional. Adding the :okexcept: option to a cell supresses
any exceptions raised within it.

I believe @adamklein added this to pandas long, long ago, I'm just propagating
things along.

Here's an example usage from the pandas docs

```
In some cases, localize cannot determine the DST and non-DST hours when there are
duplicates. This often happens when reading files that simply duplicate the hours.
The infer_dst argument in tz_localize will attempt
to determine the right offset.

.. ipython:: python
:okexcept:

rng_hourly = DatetimeIndex(['11/06/2011 00:00', '11/06/2011 01:00',
'11/06/2011 01:00', '11/06/2011 02:00',
'11/06/2011 03:00'])
rng_hourly.tz_localize('US/Eastern')
rng_hourly_eastern = rng_hourly.tz_localize('US/Eastern', infer_dst=True)
rng_hourly_eastern.values
```