Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

re-arrange mplDeprecation imports #1946

Merged
merged 2 commits into from

3 participants

@tacaswell
Owner

in #1917 @nellev requested I import mplDeprecation directly from cbook. On further investigation I found that none of the current code did that.

This PR changes the import scheme to import directly from cbook everywhere.

@tacaswell tacaswell 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
9399d82
@NelleV
Collaborator

Thanks for doing this work.

You should explicitely import cbook: either use from .cbook import blah or from matplotlib.cbook import blah.
I personnally prefer the first version, but matplotlib's codebase uses the latter (and it is the recommanded way of importing a intra package module).

@tacaswell
Owner

Should lines like

iterable = cbook.iterable
is_string_like = cbook.is_string_like
is_sequence_of_strings = cbook.is_sequence_of_strings

(from axes.py) be changed to from matplotlib.cbook import blah ?

@NelleV
Collaborator

I think it would be cleaner, but I think this is a question of personal taste so I'll leave it up to you.

@tacaswell
Owner

My inclination is to not change code that works, so I will leave it ;)

@efiring efiring merged commit 3b972d6 into from
@tacaswell tacaswell deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 25, 2013
  1. @tacaswell

    Removed the import from cbook into the matplotlib name space in __init__

    tacaswell authored
    and changed all cases of
    
    from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
    
    to
    
    from cbook import mplDeprecation
  2. @tacaswell
This page is out of date. Refresh to see the latest.
View
11 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
View
1  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
View
2  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 matplotlib.cbook import mplDeprecation
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
iterable = cbook.iterable
View
2  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 matplotlib.cbook import mplDeprecation
try:
from PIL import Image
View
2  lib/matplotlib/backends/backend_qt.py
@@ -4,7 +4,7 @@
import sys
import warnings
-from matplotlib import MatplotlibDeprecationWarning as 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.",
View
2  lib/matplotlib/backends/backend_wx.py
@@ -25,7 +25,7 @@
import numpy as np
-from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
+from matplotlib.cbook import mplDeprecation
# Debugging settings here...
# Debug level set here. If the debug level is less than 5, information
View
2  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 matplotlib.cbook import mplDeprecation
import legend_handler
View
2  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 matplotlib.cbook import mplDeprecation
import matplotlib.cbook as cbook
from matplotlib import docstring
View
2  lib/matplotlib/mpl.py
@@ -2,7 +2,7 @@
.. note:: Deprecated in 1.3
"""
import warnings
-from matplotlib import MatplotlibDeprecationWarning as 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)
View
2  lib/matplotlib/nxutils.py
@@ -1,7 +1,7 @@
import warnings
from matplotlib import path
-from matplotlib import MatplotlibDeprecationWarning as mplDeprecation
+from matplotlib.cbook import mplDeprecation
def pnpoly(x, y, xyverts):
"""
View
2  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 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
View
2  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 matplotlib.cbook import mplDeprecation
class LockDraw:
Something went wrong with that request. Please try again.