Remove old patch.
This commit is contained in:
@@ -1,126 +0,0 @@
|
||||
From 52ee5dfe73b51b55cc90f2140f2cd54a2e7946a0 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Hauser <mathause@users.noreply.github.com>
|
||||
Date: Wed, 5 Feb 2020 17:03:51 +0100
|
||||
Subject: [PATCH] remove seaborn.apionly compatibility (#3749)
|
||||
|
||||
* remove import_seaborn
|
||||
|
||||
* update tests
|
||||
|
||||
* update links
|
||||
|
||||
* add whats new
|
||||
---
|
||||
xarray/plot/utils.py | 22 +---------------------
|
||||
xarray/tests/__init__.py | 8 +-------
|
||||
xarray/tests/test_plot.py | 17 -----------------
|
||||
6 files changed, 8 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/xarray/plot/utils.py b/xarray/plot/utils.py
|
||||
index 6eec7c6b4..341ff730e 100644
|
||||
--- a/xarray/plot/utils.py
|
||||
+++ b/xarray/plot/utils.py
|
||||
@@ -21,26 +21,6 @@
|
||||
ROBUST_PERCENTILE = 2.0
|
||||
|
||||
|
||||
-def import_seaborn():
|
||||
- """import seaborn and handle deprecation of apionly module"""
|
||||
- with warnings.catch_warnings(record=True) as w:
|
||||
- warnings.simplefilter("always")
|
||||
- try:
|
||||
- import seaborn.apionly as sns
|
||||
-
|
||||
- if (
|
||||
- w
|
||||
- and issubclass(w[-1].category, UserWarning)
|
||||
- and ("seaborn.apionly module" in str(w[-1].message))
|
||||
- ):
|
||||
- raise ImportError
|
||||
- except ImportError:
|
||||
- import seaborn as sns
|
||||
- finally:
|
||||
- warnings.resetwarnings()
|
||||
- return sns
|
||||
-
|
||||
-
|
||||
_registered = False
|
||||
|
||||
|
||||
@@ -119,7 +99,7 @@ def _color_palette(cmap, n_colors):
|
||||
except ValueError:
|
||||
# ValueError happens when mpl doesn't like a colormap, try seaborn
|
||||
try:
|
||||
- from seaborn.apionly import color_palette
|
||||
+ from seaborn import color_palette
|
||||
|
||||
pal = color_palette(cmap, n_colors=n_colors)
|
||||
except (ValueError, ImportError):
|
||||
diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py
|
||||
index 6592360cd..df86b5715 100644
|
||||
--- a/xarray/tests/__init__.py
|
||||
+++ b/xarray/tests/__init__.py
|
||||
@@ -16,7 +16,6 @@
|
||||
from xarray.core.duck_array_ops import allclose_or_equiv # noqa: F401
|
||||
from xarray.core.indexing import ExplicitlyIndexed
|
||||
from xarray.core.options import set_options
|
||||
-from xarray.plot.utils import import_seaborn
|
||||
|
||||
# import mpl and change the backend before other mpl imports
|
||||
try:
|
||||
@@ -71,6 +70,7 @@ def LooseVersion(vstring):
|
||||
has_iris, requires_iris = _importorskip("iris")
|
||||
has_cfgrib, requires_cfgrib = _importorskip("cfgrib")
|
||||
has_numbagg, requires_numbagg = _importorskip("numbagg")
|
||||
+has_seaborn, requires_seaborn = _importorskip("seaborn")
|
||||
has_sparse, requires_sparse = _importorskip("sparse")
|
||||
|
||||
# some special cases
|
||||
@@ -78,12 +78,6 @@ def LooseVersion(vstring):
|
||||
requires_scipy_or_netCDF4 = pytest.mark.skipif(
|
||||
not has_scipy_or_netCDF4, reason="requires scipy or netCDF4"
|
||||
)
|
||||
-try:
|
||||
- import_seaborn()
|
||||
- has_seaborn = True
|
||||
-except ImportError:
|
||||
- has_seaborn = False
|
||||
-requires_seaborn = pytest.mark.skipif(not has_seaborn, reason="requires seaborn")
|
||||
|
||||
# change some global options for tests
|
||||
set_options(warn_for_unclosed_files=True)
|
||||
diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py
|
||||
index 71cb119f0..dda9e5de3 100644
|
||||
--- a/xarray/tests/test_plot.py
|
||||
+++ b/xarray/tests/test_plot.py
|
||||
@@ -14,7 +14,6 @@
|
||||
_build_discrete_cmap,
|
||||
_color_palette,
|
||||
_determine_cmap_params,
|
||||
- import_seaborn,
|
||||
label_from_attrs,
|
||||
)
|
||||
|
||||
@@ -2118,22 +2117,6 @@ def test_ncaxis_notinstalled_line_plot(self):
|
||||
self.darray.plot.line()
|
||||
|
||||
|
||||
-@requires_seaborn
|
||||
-def test_import_seaborn_no_warning():
|
||||
- # GH1633
|
||||
- with pytest.warns(None) as record:
|
||||
- import_seaborn()
|
||||
- assert len(record) == 0
|
||||
-
|
||||
-
|
||||
-@requires_matplotlib
|
||||
-def test_plot_seaborn_no_import_warning():
|
||||
- # GH1633
|
||||
- with pytest.warns(None) as record:
|
||||
- _color_palette("Blues", 4)
|
||||
- assert len(record) == 0
|
||||
-
|
||||
-
|
||||
test_da_list = [
|
||||
DataArray(easy_array((10,))),
|
||||
DataArray(easy_array((10, 3))),
|
||||
Reference in New Issue
Block a user