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

Skip to content

Commit 27f94c7

Browse files
committed
Make mlab.csv2rec private
1 parent a2306e4 commit 27f94c7

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

doc/api/next_api_changes/2018-09-18-DS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ in Matplotlib 2.2 has been removed. See below for a list:
5555
- ``mlab.poly_between``
5656
- ``mlab.poly_below``
5757
- ``mlab.inside_poly``
58+
- ``mlab.csv2rec``
5859
- ``mlab.rec2csv`` (use `numpy.recarray.tofile` instead)
5960
- ``mlab.rec2text`` (use `numpy.recarray.tofile` instead)
6061
- ``mlab.rec_summarize``

lib/matplotlib/mlab.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,10 +1187,9 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
11871187
return Cxy, f
11881188

11891189

1190-
@cbook.deprecated("2.2")
1191-
def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',',
1192-
converterd=None, names=None, missing='', missingd=None,
1193-
use_mrecords=False, dayfirst=False, yearfirst=False):
1190+
def _csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',',
1191+
converterd=None, names=None, missing='', missingd=None,
1192+
use_mrecords=False, dayfirst=False, yearfirst=False):
11941193
"""
11951194
Load data from comma/space/tab delimited file in *fname* into a
11961195
numpy record array and return the record array.

lib/matplotlib/pylab.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@
229229
## We are still importing too many things from mlab; more cleanup is needed.
230230

231231
from matplotlib.mlab import (
232-
csv2rec,
233232
demean, detrend, detrend_linear, detrend_mean, detrend_none,
234233
window_hanning, window_none)
235234

lib/matplotlib/pyplot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
from matplotlib.artist import setp as _setp
4747
from matplotlib.axes import Axes, Subplot
4848
from matplotlib.projections import PolarAxes
49-
from matplotlib import mlab # for csv2rec, detrend_none, window_hanning
49+
from matplotlib import mlab # for _csv2rec, detrend_none, window_hanning
5050
from matplotlib.scale import get_scale_docs, get_scale_names
5151

5252
from matplotlib import cm
@@ -2230,8 +2230,7 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
22302230
columns.
22312231
22322232
*comments*, *skiprows*, *checkrows*, *delimiter*, and *names*
2233-
are all passed on to :func:`matplotlib.mlab.csv2rec` to
2234-
load the data into a record array.
2233+
are all used when loading the data into a record array.
22352234
22362235
If *newfig* is *True*, the plot always will be made in a new figure;
22372236
if *False*, it will be made in the current figure if one exists,
@@ -2266,8 +2265,9 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
22662265
from matplotlib.cbook import MatplotlibDeprecationWarning
22672266
with warnings.catch_warnings():
22682267
warnings.simplefilter('ignore', MatplotlibDeprecationWarning)
2269-
r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows,
2270-
checkrows=checkrows, delimiter=delimiter, names=names)
2268+
r = mlab._csv2rec(fname, comments=comments, skiprows=skiprows,
2269+
checkrows=checkrows, delimiter=delimiter,
2270+
names=names)
22712271

22722272
def getname_val(identifier):
22732273
'return the name and column data for identifier'

lib/matplotlib/tests/test_mlab.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,9 @@ def tempcsv():
151151

152152

153153
def test_csv2rec_names_with_comments(tempcsv):
154-
155154
tempcsv.write('# comment\n1,2,3\n4,5,6\n')
156155
tempcsv.seek(0)
157-
with pytest.warns(MatplotlibDeprecationWarning):
158-
array = mlab.csv2rec(tempcsv, names='a,b,c')
156+
array = mlab._csv2rec(tempcsv, names='a,b,c')
159157
assert len(array) == 2
160158
assert len(array.dtype) == 3
161159

@@ -188,8 +186,7 @@ def test_csv2rec_dates(tempcsv, input, kwargs):
188186
datetime.datetime(2054, 6, 20, 14, 31, 45),
189187
datetime.datetime(2000, 10, 31, 11, 50, 23)]
190188
tempcsv.seek(0)
191-
with pytest.warns(MatplotlibDeprecationWarning):
192-
array = mlab.csv2rec(tempcsv, names='a', **kwargs)
189+
array = mlab._csv2rec(tempcsv, names='a', **kwargs)
193190
assert_array_equal(array['a'].tolist(), expected)
194191

195192

0 commit comments

Comments
 (0)