Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb98e6f

Browse files
committed
Removed deprecated functions from the module cbook
1 parent 97c264d commit cb98e6f

File tree

1 file changed

+9
-82
lines changed

1 file changed

+9
-82
lines changed

lib/matplotlib/cbook.py

Lines changed: 9 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343

4444
if sys.version_info[0] >= 3:
4545
def unicode_safe(s):
46-
import matplotlib
47-
4846
try:
4947
preferredencoding = locale.getpreferredencoding(
5048
matplotlib.rcParams['axes.formatter.use_locale']).strip()
@@ -274,12 +272,14 @@ class CallbackRegistry:
274272
functions). This technique was shared by Peter Parente on his
275273
`"Mindtrove" blog
276274
<http://mindtrove.info/articles/python-weak-references/>`_.
275+
276+
.. deprecated:: 1.3.0
277277
"""
278278
def __init__(self, *args):
279279
if len(args):
280280
warnings.warn(
281-
'CallbackRegistry no longer requires a list of callback types.'
282-
' Ignoring arguments',
281+
"CallbackRegistry no longer requires a list of callback "
282+
"types. Ignoring arguments. *args will be removed in 1.5",
283283
mplDeprecation)
284284
self.callbacks = dict()
285285
self._cid = 0
@@ -538,7 +538,6 @@ def to_filehandle(fname, flag='rU', return_opened=False):
538538
"""
539539
if is_string_like(fname):
540540
if fname.endswith('.gz'):
541-
import gzip
542541
# get rid of 'U' in flag for gzipped files.
543542
flag = flag.replace('U', '')
544543
fh = gzip.open(fname, flag)
@@ -831,6 +830,7 @@ def append(self, x):
831830
if len(self.data) == self.max:
832831
self.cur = 0
833832
# Permanently change self's class from non-full to full
833+
# FIXME __Full is not defined
834834
self.__class__ = __Full
835835

836836
def get(self):
@@ -1298,7 +1298,7 @@ def xy(self, i0=0, isub=1):
12981298

12991299
def plot(self, i0=0, isub=1, fig=None):
13001300
if fig is None:
1301-
from pylab import figure, show
1301+
from pylab import figure
13021302
fig = figure()
13031303

13041304
ax = fig.add_subplot(111)
@@ -1608,8 +1608,9 @@ def delete_masked_points(*args):
16081608
return margs
16091609

16101610

1611+
# FIXME I don't think this is used anywhere
16111612
def unmasked_index_ranges(mask, compressed=True):
1612-
'''
1613+
"""
16131614
Find index ranges where *mask* is *False*.
16141615
16151616
*mask* will be flattened if it is not already 1-D.
@@ -1639,8 +1640,7 @@ def unmasked_index_ranges(mask, compressed=True):
16391640
16401641
Prior to the transforms refactoring, this was used to support
16411642
masked arrays in Line2D.
1642-
1643-
'''
1643+
"""
16441644
mask = mask.reshape(mask.size)
16451645
m = np.concatenate(((1,), mask, (1,)))
16461646
indices = np.arange(len(mask) + 1)
@@ -1668,79 +1668,6 @@ def unmasked_index_ranges(mask, compressed=True):
16681668
ls_mapper.update([(ls[1], ls[0]) for ls in _linestyles])
16691669

16701670

1671-
def less_simple_linear_interpolation(x, y, xi, extrap=False):
1672-
"""
1673-
This function has been moved to matplotlib.mlab -- please import
1674-
it from there
1675-
"""
1676-
# deprecated from cbook in 0.98.4
1677-
warnings.warn('less_simple_linear_interpolation has been moved to '
1678-
'matplotlib.mlab -- please import it from there',
1679-
mplDeprecation)
1680-
import matplotlib.mlab as mlab
1681-
return mlab.less_simple_linear_interpolation(x, y, xi, extrap=extrap)
1682-
1683-
1684-
def vector_lengths(X, P=2.0, axis=None):
1685-
"""
1686-
This function has been moved to matplotlib.mlab -- please import
1687-
it from there
1688-
"""
1689-
# deprecated from cbook in 0.98.4
1690-
warnings.warn('vector_lengths has been moved to matplotlib.mlab -- '
1691-
'please import it from there', mplDeprecation)
1692-
import matplotlib.mlab as mlab
1693-
return mlab.vector_lengths(X, P=2.0, axis=axis)
1694-
1695-
1696-
def distances_along_curve(X):
1697-
"""
1698-
This function has been moved to matplotlib.mlab -- please import
1699-
it from there
1700-
"""
1701-
# deprecated from cbook in 0.98.4
1702-
warnings.warn('distances_along_curve has been moved to matplotlib.mlab '
1703-
'-- please import it from there', mplDeprecation)
1704-
import matplotlib.mlab as mlab
1705-
return mlab.distances_along_curve(X)
1706-
1707-
1708-
def path_length(X):
1709-
"""
1710-
This function has been moved to matplotlib.mlab -- please import
1711-
it from there
1712-
"""
1713-
# deprecated from cbook in 0.98.4
1714-
warnings.warn('path_length has been moved to matplotlib.mlab '
1715-
'-- please import it from there', mplDeprecation)
1716-
import matplotlib.mlab as mlab
1717-
return mlab.path_length(X)
1718-
1719-
1720-
def is_closed_polygon(X):
1721-
"""
1722-
This function has been moved to matplotlib.mlab -- please import
1723-
it from there
1724-
"""
1725-
# deprecated from cbook in 0.98.4
1726-
warnings.warn('is_closed_polygon has been moved to matplotlib.mlab '
1727-
'-- please import it from there', mplDeprecation)
1728-
import matplotlib.mlab as mlab
1729-
return mlab.is_closed_polygon(X)
1730-
1731-
1732-
def quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y):
1733-
"""
1734-
This function has been moved to matplotlib.mlab -- please import
1735-
it from there
1736-
"""
1737-
# deprecated from cbook in 0.98.4
1738-
warnings.warn('quad2cubic has been moved to matplotlib.mlab -- please '
1739-
'import it from there', mplDeprecation)
1740-
import matplotlib.mlab as mlab
1741-
return mlab.quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y)
1742-
1743-
17441671
def align_iterators(func, *iterables):
17451672
"""
17461673
This generator takes a bunch of iterables that are ordered by func

0 commit comments

Comments
 (0)