From: <jd...@us...> - 2009-08-05 12:04:47
|
Revision: 7362 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7362&view=rev Author: jdh2358 Date: 2009-08-05 12:04:36 +0000 (Wed, 05 Aug 2009) Log Message: ----------- added a new mpl data example script to test svn commits on the data Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/cbook.py Added Paths: ----------- trunk/matplotlib/examples/misc/mpl_data_test.py Added: trunk/matplotlib/examples/misc/mpl_data_test.py =================================================================== --- trunk/matplotlib/examples/misc/mpl_data_test.py (rev 0) +++ trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -0,0 +1,13 @@ +""" +Demonstrate how get_mpl_data works with svn revisions in the data. + + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_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) +""" + +import matplotlib.cbook as cbook +fh = cbook.get_mpl_data("testdata.csv") +print fh.read() Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2009-08-05 11:39:37 UTC (rev 7361) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -89,7 +89,7 @@ """ from __future__ import generators -__version__ = '0.99.0.rc1' +__version__ = '1.0.svn' __revision__ = '$Revision$' __date__ = '$Date$' Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 11:39:37 UTC (rev 7361) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -356,7 +356,7 @@ def in_cache_dir(self, fn): return os.path.join(self.cache_dir, fn) - + def read_cache(self): """ Read the cache file from the cache directory. @@ -386,7 +386,7 @@ for path in os.listdir(self.cache_dir): if path not in listed and path != 'cache.pck': os.remove(os.path.join(self.cache_dir, path)) - + def write_cache(self): """ Write the cache data structure into the cache directory. @@ -419,7 +419,7 @@ # http_request for preprocessing requests # http_error_304 for handling 304 Not Modified responses # http_response for postprocessing requests - + def http_request(self, req): """ Make the request conditional if we have a cached file. @@ -441,7 +441,7 @@ handle = urllib2.addinfourl(file, hdrs, url) handle.code = 304 return handle - + def http_response(self, req, response): """ Update the cache with the returned file. @@ -473,7 +473,7 @@ To add a datafile to this directory, you need to check out mpl_data from matplotlib svn:: - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/mpl_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data @@ -497,7 +497,7 @@ response.close() p = get_mpl_data.processor return p.in_cache_dir(p.cache[url][0]) - + def flatten(seq, scalarp=is_scalar_or_string): """ this generator flattens nested containers such as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |