From 3820c35a39b6ee121ae9eccadccca1df69a1a645 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Sat, 11 Nov 2017 18:03:50 -0800 Subject: [PATCH] Fix importing xarray with python -OO Fixes GH1706 --- .travis.yml | 1 + doc/whats-new.rst | 3 +++ xarray/plot/plot.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1dc0cb9b207..d797e9844bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -89,6 +89,7 @@ install: - python xarray/util/print_versions.py script: + - python -OO -c "import xarray" - py.test xarray --cov=xarray --cov-config ci/.coveragerc --cov-report term-missing --verbose $EXTRA_FLAGS - git diff upstream/master **/*py | flake8 --diff --exit-zero || true diff --git a/doc/whats-new.rst b/doc/whats-new.rst index dd775417132..668e70a42d9 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -43,6 +43,9 @@ Bug fixes ``NumpyIndexingAdapter``. (:issue:`1694`) By `Keisuke Fujii `_ +- Fix importing xarray when running Python with ``-OO`` (:issue:`1706`). + By `Stephan Hoyer `_. + - Fix two bugs that were preventing dask arrays from being specified as coordinates in the DataArray constructor (:issue:`1684`). By `Joe Hamman `_ diff --git a/xarray/plot/plot.py b/xarray/plot/plot.py index 0320b49b5be..a908de65362 100644 --- a/xarray/plot/plot.py +++ b/xarray/plot/plot.py @@ -402,7 +402,7 @@ def _plot2d(plotfunc): """ # Build on the original docstring - plotfunc.__doc__ = '\n'.join((plotfunc.__doc__, commondoc)) + plotfunc.__doc__ = '%s\n%s' % (plotfunc.__doc__, commondoc) @functools.wraps(plotfunc) def newplotfunc(darray, x=None, y=None, figsize=None, size=None,