From 9399d823af71036e039998282ee307a22f1871c9 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 25 Apr 2013 11:10:14 -0500 Subject: [PATCH 1/2] Removed the import from cbook into the matplotlib name space in __init__ and changed all cases of from matplotlib import MatplotlibDeprecationWarning as mplDeprecation to from cbook import mplDeprecation --- CHANGELOG | 11 +++++++++++ lib/matplotlib/__init__.py | 1 - lib/matplotlib/axes.py | 2 +- lib/matplotlib/backend_bases.py | 2 +- lib/matplotlib/backends/backend_qt.py | 2 +- lib/matplotlib/backends/backend_wx.py | 2 +- lib/matplotlib/legend.py | 2 +- lib/matplotlib/mlab.py | 2 +- lib/matplotlib/mpl.py | 2 +- lib/matplotlib/nxutils.py | 2 +- lib/matplotlib/patches.py | 2 +- lib/matplotlib/widgets.py | 2 +- 12 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4082c39fd98a..8f810db398ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +2013-04-25 Changed all instances of: + + from matplotlib import MatplotlibDeprecationWarning as mplDeprecation + to: + + from cbook import mplDeprecation + + and removed the import into the matplotlib namespace in __init__.py + Thomas Caswell + + 2013-04-15 Added 'axes.xmargin' and 'axes.ymargin' to rpParams to set default margins on auto-scaleing. - TAC diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 953b73834d3b..891bdaa120b3 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -130,7 +130,6 @@ # cbook must import matplotlib only within function # definitions, so it is safe to import from it here. -from matplotlib.cbook import MatplotlibDeprecationWarning from matplotlib.cbook import is_string_like from matplotlib.compat import subprocess diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index d28025a32943..3cc38a7dd654 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -37,7 +37,7 @@ import matplotlib.ticker as mticker import matplotlib.transforms as mtransforms import matplotlib.tri as mtri -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer iterable = cbook.iterable diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index d2f5b9c942fd..ee7e7fc8b33d 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -49,7 +49,7 @@ import matplotlib.tight_bbox as tight_bbox import matplotlib.textpath as textpath from matplotlib.path import Path -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation try: from PIL import Image diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 9b009cf5ac8d..b2ae840e35a5 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -4,7 +4,7 @@ import sys import warnings -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation warnings.warn("QT3-based backends are deprecated and will be removed after" " the v1.2.x release. Use the equivalent QT4 backend instead.", diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index c0cb2a52a79d..b43a257e0899 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -25,7 +25,7 @@ import numpy as np -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation # Debugging settings here... # Debug level set here. If the debug level is less than 5, information diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 15a27e1cba00..a1aa14773f41 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -31,7 +31,7 @@ from matplotlib.offsetbox import DraggableOffsetBox from matplotlib.container import ErrorbarContainer, BarContainer, StemContainer -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation import legend_handler diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 17168194caa6..4d55308da89e 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -148,7 +148,7 @@ import numpy as np ma = np.ma from matplotlib import verbose -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation import matplotlib.cbook as cbook from matplotlib import docstring diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index 51e8a3204b73..4d7cda94a1ae 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -2,7 +2,7 @@ .. note:: Deprecated in 1.3 """ import warnings -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation warnings.warn( "matplotlib.mpl is deprecated and will be removed in version 1.4." "Please use `import matplotlib as mpl` instead", mplDeprecation) diff --git a/lib/matplotlib/nxutils.py b/lib/matplotlib/nxutils.py index 357a567844d6..af26da161411 100644 --- a/lib/matplotlib/nxutils.py +++ b/lib/matplotlib/nxutils.py @@ -1,7 +1,7 @@ import warnings from matplotlib import path -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation def pnpoly(x, y, xyverts): """ diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 2c8239f4434b..5f55ad67f370 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -12,7 +12,7 @@ from matplotlib import docstring import matplotlib.transforms as transforms from matplotlib.path import Path -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation # these are not available for the object inspector until after the # class is built so we define an initial set here for the init diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 1a7997812d20..6dac270a15dc 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -16,7 +16,7 @@ from patches import Circle, Rectangle from lines import Line2D from transforms import blended_transform_factory -from matplotlib import MatplotlibDeprecationWarning as mplDeprecation +from cbook import mplDeprecation class LockDraw: From ab6e9ab6b077d51932afebc7d513436758b8c2c4 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 25 Apr 2013 11:28:32 -0500 Subject: [PATCH 2/2] tweaked intra-package imports from cbook --- lib/matplotlib/axes.py | 2 +- lib/matplotlib/backend_bases.py | 2 +- lib/matplotlib/backends/backend_qt.py | 2 +- lib/matplotlib/backends/backend_wx.py | 2 +- lib/matplotlib/legend.py | 2 +- lib/matplotlib/mlab.py | 2 +- lib/matplotlib/mpl.py | 2 +- lib/matplotlib/nxutils.py | 2 +- lib/matplotlib/patches.py | 2 +- lib/matplotlib/widgets.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index 3cc38a7dd654..c46815650f79 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -37,7 +37,7 @@ import matplotlib.ticker as mticker import matplotlib.transforms as mtransforms import matplotlib.tri as mtri -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer iterable = cbook.iterable diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index ee7e7fc8b33d..c4e3845ab0a7 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -49,7 +49,7 @@ import matplotlib.tight_bbox as tight_bbox import matplotlib.textpath as textpath from matplotlib.path import Path -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation try: from PIL import Image diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index b2ae840e35a5..dda129dfbd1c 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -4,7 +4,7 @@ import sys import warnings -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation warnings.warn("QT3-based backends are deprecated and will be removed after" " the v1.2.x release. Use the equivalent QT4 backend instead.", diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index b43a257e0899..67da1db4189b 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -25,7 +25,7 @@ import numpy as np -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation # Debugging settings here... # Debug level set here. If the debug level is less than 5, information diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index a1aa14773f41..25a66dda686a 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -31,7 +31,7 @@ from matplotlib.offsetbox import DraggableOffsetBox from matplotlib.container import ErrorbarContainer, BarContainer, StemContainer -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation import legend_handler diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 4d55308da89e..ff416c86c873 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -148,7 +148,7 @@ import numpy as np ma = np.ma from matplotlib import verbose -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation import matplotlib.cbook as cbook from matplotlib import docstring diff --git a/lib/matplotlib/mpl.py b/lib/matplotlib/mpl.py index 4d7cda94a1ae..877a99da1de1 100644 --- a/lib/matplotlib/mpl.py +++ b/lib/matplotlib/mpl.py @@ -2,7 +2,7 @@ .. note:: Deprecated in 1.3 """ import warnings -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation warnings.warn( "matplotlib.mpl is deprecated and will be removed in version 1.4." "Please use `import matplotlib as mpl` instead", mplDeprecation) diff --git a/lib/matplotlib/nxutils.py b/lib/matplotlib/nxutils.py index af26da161411..9ac5353baf0a 100644 --- a/lib/matplotlib/nxutils.py +++ b/lib/matplotlib/nxutils.py @@ -1,7 +1,7 @@ import warnings from matplotlib import path -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation def pnpoly(x, y, xyverts): """ diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 5f55ad67f370..986b5f6c1c21 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -12,7 +12,7 @@ from matplotlib import docstring import matplotlib.transforms as transforms from matplotlib.path import Path -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation # these are not available for the object inspector until after the # class is built so we define an initial set here for the init diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 6dac270a15dc..5e2ec4e11af6 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -16,7 +16,7 @@ from patches import Circle, Rectangle from lines import Line2D from transforms import blended_transform_factory -from cbook import mplDeprecation +from matplotlib.cbook import mplDeprecation class LockDraw: