example data in example code

John Hunter <jdh2358@...149...> writes:

* 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 :slight_smile:

I did that in case someone wanted to retrieve files from several
different locations -- my version of the cache handler was not tied to
any particular base URL. Since all cached files were in one flat
directory, there was the danger of filename collisions.

* 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 think mirroring a directory structure is somewhat more complicated
than caching a set of arbitrary URLs in a flat cache directory. For
example, I think the remove_stale_files method will need to be changed
to walk all subdirectories, and handling cases such as having a
subdirectory named foo that is replaced by a file named foo could be
complicated.

One thing that's still missing is off-line usage: if the user does not
have net connectivity at the moment but does have the file in the cache,
it should not cause an error.

Perhaps the base URL should be
http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
instead of
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/
to avoid dependency on the viewvc service of SourceForge.

路路路

--
Jouni K. Sepp锟絥en
http://www.iki.fi/jks

Would you like to take a crack at these fixes? I have scipy coming up
and need to start getting my tutorial material together, so I am not
going to have a lot of time for bug fixes, though I would be happy to
get as many fixes and patches in next week and try to get one bugfix
0.99.1 out before scipy.

JDH

路路路

On Sun, Aug 9, 2009 at 2:01 PM, Jouni K. Sepp盲nen<jks@...278...> wrote:

I think mirroring a directory structure is somewhat more complicated
than caching a set of arbitrary URLs in a flat cache directory. For
example, I think the remove_stale_files method will need to be changed
to walk all subdirectories, and handling cases such as having a
subdirectory named foo that is replaced by a file named foo could be
complicated.

One thing that's still missing is off-line usage: if the user does not
have net connectivity at the moment but does have the file in the cache,
it should not cause an error.

Perhaps the base URL should be
http://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data/
instead of
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/
to avoid dependency on the viewvc service of SourceForge.