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

Skip to content

Commit d0268e4

Browse files
committed
added a new mpl data example script to test svn commits on the data
svn path=/trunk/matplotlib/; revision=7362
1 parent 0e9da87 commit d0268e4

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

examples/misc/mpl_data_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Demonstrate how get_mpl_data works with svn revisions in the data.
3+
4+
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data
5+
6+
and edit testdata.csv to add a new row. After committing the changes,
7+
when you rerun this script you will get the updated data (and the new
8+
svn version will be cached in ~/.matplotlib/mpl_data)
9+
"""
10+
11+
import matplotlib.cbook as cbook
12+
fh = cbook.get_mpl_data("testdata.csv")
13+
print fh.read()

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"""
9090
from __future__ import generators
9191

92-
__version__ = '0.99.0.rc1'
92+
__version__ = '1.0.svn'
9393
__revision__ = '$Revision$'
9494
__date__ = '$Date$'
9595

lib/matplotlib/cbook.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def __init__(self, cache_dir):
356356

357357
def in_cache_dir(self, fn):
358358
return os.path.join(self.cache_dir, fn)
359-
359+
360360
def read_cache(self):
361361
"""
362362
Read the cache file from the cache directory.
@@ -386,7 +386,7 @@ def remove_stale_files(self):
386386
for path in os.listdir(self.cache_dir):
387387
if path not in listed and path != 'cache.pck':
388388
os.remove(os.path.join(self.cache_dir, path))
389-
389+
390390
def write_cache(self):
391391
"""
392392
Write the cache data structure into the cache directory.
@@ -419,7 +419,7 @@ def cache_file(self, url, data, headers):
419419
# http_request for preprocessing requests
420420
# http_error_304 for handling 304 Not Modified responses
421421
# http_response for postprocessing requests
422-
422+
423423
def http_request(self, req):
424424
"""
425425
Make the request conditional if we have a cached file.
@@ -441,7 +441,7 @@ def http_error_304(self, req, fp, code, msg, hdrs):
441441
handle = urllib2.addinfourl(file, hdrs, url)
442442
handle.code = 304
443443
return handle
444-
444+
445445
def http_response(self, req, response):
446446
"""
447447
Update the cache with the returned file.
@@ -473,7 +473,7 @@ def get_mpl_data(fname, asfileobj=True):
473473
To add a datafile to this directory, you need to check out
474474
mpl_data from matplotlib svn::
475475
476-
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/mpl_data
476+
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data
477477
478478
and svn add the data file you want to support. This is primarily
479479
intended for use in mpl examples that need custom data
@@ -497,7 +497,7 @@ def get_mpl_data(fname, asfileobj=True):
497497
response.close()
498498
p = get_mpl_data.processor
499499
return p.in_cache_dir(p.cache[url][0])
500-
500+
501501
def flatten(seq, scalarp=is_scalar_or_string):
502502
"""
503503
this generator flattens nested containers such as

0 commit comments

Comments
 (0)