From: John H. <jd...@gm...> - 2009-08-05 15:21:39
|
On Wed, Aug 5, 2009 at 7:11 AM, John Hunter<jd...@gm...> wrote: > Perhaps we could return a plain file handle pointing to the cached data? OK, I've made a few changes to the code so Jouni you will probably want to review them * I renamed the svn repo and function to be "sample_data" rather than "mpl_data" to avoid confusion with lib/matplotlib/mpl-data. The svn repo, the examples and the cbook function have all been renamed. The repo is :: svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and the examples are:: johnh@udesktop191:mpl> ls examples/misc/sam*.py examples/misc/sample_data_demo.py examples/misc/sample_data_test.py * I added support for nested subdirs, so you can now do, as in examples/misc/sample_data_test.py:: datafile = 'testdir/subdir/testsub.csv' fh = cbook.get_sample_data(datafile) * I commented out the random number appending, because I do not see the use case, but we can re-add it when you enlighten me :-) * I always return a file handle to the cached file, so seek works, and is exercised in examples/misc/sample_data_test.py It is probably worth doing a little more work to make the processor plus the "get_sample_data" function all part of one class, so other people can reuse it with other repos and other dirs. Eg, something like the following in cbook:: myserver = ViewVCCacheServer(mycachedir, myurlbase) get_sample_data = myserver.get_sample_data |