Revision: 7365
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7365&view=rev
Author: jdh2358
Date: 2009-08-05 14:38:44 +0000 (Wed, 05 Aug 2009)
Log Message:
-----------
rename mpl_data to sample_data to avoid ambiguity with lib/matplotlib/mpl-data
Modified Paths:
--------------
trunk/matplotlib/examples/misc/mpl_data_demo.py
trunk/matplotlib/examples/misc/mpl_data_test.py
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/examples/misc/mpl_data_demo.py
===================================================================
--- trunk/matplotlib/examples/misc/mpl_data_demo.py 2009-08-05 14:36:27 UTC
(rev 7364)
+++ trunk/matplotlib/examples/misc/mpl_data_demo.py 2009-08-05 14:38:44 UTC
(rev 7365)
@@ -1,10 +1,10 @@
"""
-Grab mpl data from the ~/.matplotlib/mpl_data cache if it exists, else
+Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else
fetch it from svn and cache it
"""
import matplotlib.cbook as cbook
import matplotlib.pyplot as plt
-fname = cbook.get_mpl_data('lena.png', asfileobj=False)
+fname = cbook.get_sample_data('lena.png', asfileobj=False)
print 'fname', fname
im = plt.imread(fname)
Modified: trunk/matplotlib/examples/misc/mpl_data_test.py
===================================================================
--- trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 14:36:27 UTC
(rev 7364)
+++ trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 14:38:44 UTC
(rev 7365)
@@ -1,13 +1,13 @@
"""
-Demonstrate how get_mpl_data works with svn revisions in the data.
+Demonstrate how get_sample_data works with svn revisions in the data.
- svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data
+ svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data
and edit testdata.csv to add a new row. After committing the changes,
when you rerun this script you will get the updated data (and the new
-svn version will be cached in ~/.matplotlib/mpl_data)
+svn version will be cached in ~/.matplotlib/sample_data)
"""
import matplotlib.cbook as cbook
-fh = cbook.get_mpl_data("testdata.csv")
+fh = cbook.get_sample_data("testdata.csv")
print fh.read()
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 14:36:27 UTC (rev
7364)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 14:38:44 UTC (rev
7365)
@@ -458,12 +458,12 @@
result.msg = response.msg
return result
-def get_mpl_data(fname, asfileobj=True):
+def get_sample_data(fname, asfileobj=True):
"""
- Check the cachedirectory ~/.matplotlib/mpl_data for an mpl_data
+ Check the cachedirectory ~/.matplotlib/sample_data for an sample_data
file. If it does not exist, fetch it with urllib from the mpl svn repo
- http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/
+
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/
and store it in the cachedir.
@@ -471,31 +471,31 @@
path to the file as a string will be returned
To add a datafile to this directory, you need to check out
- mpl_data from matplotlib svn::
+ sample_data from matplotlib svn::
- svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data
+ svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data
and svn add the data file you want to support. This is primarily
intended for use in mpl examples that need custom data
"""
- if not hasattr(get_mpl_data, 'opener'):
+ if not hasattr(get_sample_data, 'opener'):
configdir = matplotlib.get_configdir()
- cachedir = os.path.join(configdir, 'mpl_data')
+ cachedir = os.path.join(configdir, 'sample_data')
if not os.path.exists(cachedir):
os.mkdir(cachedir)
# Store the cache processor and url opener as attributes of this
function
- get_mpl_data.processor = _CacheProcessor(cachedir)
- get_mpl_data.opener = urllib2.build_opener(get_mpl_data.processor)
+ get_sample_data.processor = _CacheProcessor(cachedir)
+ get_sample_data.opener =
urllib2.build_opener(get_sample_data.processor)
- url =
'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/' + \
+ url =
'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/' + \
urllib2.quote(fname)
- response = get_mpl_data.opener.open(url)
+ response = get_sample_data.opener.open(url)
if asfileobj:
return response
else:
response.close()
- p = get_mpl_data.processor
+ p = get_sample_data.processor
return p.in_cache_dir(p.cache[url][0])
def flatten(seq, scalarp=is_scalar_or_string):
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins