SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <ry...@us...> - 2010年07月15日 03:34:40
Revision: 8552
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8552&view=rev
Author: ryanmay
Date: 2010年07月15日 03:34:32 +0000 (2010年7月15日)
Log Message:
-----------
Convert uses of the builtin file() to the builtin open(). Calls to file() are not converted by 2to3.
Modified Paths:
--------------
 branches/py3k/lib/matplotlib/__init__.py
 branches/py3k/lib/matplotlib/afm.py
 branches/py3k/lib/matplotlib/cbook.py
 branches/py3k/lib/matplotlib/finance.py
 branches/py3k/lib/matplotlib/mathtext.py
 branches/py3k/lib/matplotlib/mlab.py
 branches/py3k/lib/matplotlib/texmanager.py
Modified: branches/py3k/lib/matplotlib/__init__.py
===================================================================
--- branches/py3k/lib/matplotlib/__init__.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/__init__.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -222,7 +222,7 @@
 self.fileo = std[fname]
 else:
 try:
- fileo = file(fname, 'w')
+ fileo = open(fname, 'w')
 except IOError:
 raise ValueError('Verbose object could not open log file "%s" for writing.\nCheck your matplotlibrc verbose.fileo setting'%fname)
 else:
@@ -670,7 +670,7 @@
 
 cnt = 0
 rc_temp = {}
- for line in file(fname):
+ for line in open(fname):
 cnt += 1
 strippedline = line.split('#',1)[0].strip()
 if not strippedline: continue
Modified: branches/py3k/lib/matplotlib/afm.py
===================================================================
--- branches/py3k/lib/matplotlib/afm.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/afm.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -14,7 +14,7 @@
 It is pretty easy to use, and requires only built-in python libs::
 
 >>> from afm import AFM
- >>> fh = file('ptmr8a.afm')
+ >>> fh = open('ptmr8a.afm')
 >>> afm = AFM(fh)
 >>> afm.string_width_height('What the heck?')
 (6220.0, 683)
@@ -499,6 +499,6 @@
 pathname = '/usr/local/share/fonts/afms/adobe'
 
 for fname in os.listdir(pathname):
- fh = file(os.path.join(pathname,fname))
+ fh = open(os.path.join(pathname,fname))
 afm = AFM(fh)
 w,h = afm.string_width_height('John Hunter is the Man!')
Modified: branches/py3k/lib/matplotlib/cbook.py
===================================================================
--- branches/py3k/lib/matplotlib/cbook.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/cbook.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -437,7 +437,7 @@
 import bz2
 fh = bz2.BZ2File(fname, flag)
 else:
- fh = file(fname, flag)
+ fh = open(fname, flag)
 opened = True
 elif hasattr(fname, 'seek'):
 fh = fname
Modified: branches/py3k/lib/matplotlib/finance.py
===================================================================
--- branches/py3k/lib/matplotlib/finance.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/finance.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -166,18 +166,18 @@
 if cachename is None:
 cachename = os.path.join(cachedir, md5(url).hexdigest())
 if os.path.exists(cachename):
- fh = file(cachename)
+ fh = open(cachename)
 verbose.report('Using cachefile %s for %s'%(cachename, ticker))
 else:
 if not os.path.isdir(cachedir):
 os.mkdir(cachedir)
 urlfh = urlopen(url)
 
- fh = file(cachename, 'w')
+ fh = open(cachename, 'w')
 fh.write(urlfh.read())
 fh.close()
 verbose.report('Saved %s data to cache file %s'%(ticker, cachename))
- fh = file(cachename, 'r')
+ fh = open(cachename, 'r')
 
 return fh
 
Modified: branches/py3k/lib/matplotlib/mathtext.py
===================================================================
--- branches/py3k/lib/matplotlib/mathtext.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/mathtext.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -1051,7 +1051,7 @@
 if filename is None:
 filename = findfont('Helvetica', fontext='afm',
 directory=self.basepath)
- default_font = AFM(file(filename, 'r'))
+ default_font = AFM(open(filename, 'r'))
 default_font.fname = filename
 
 self.fonts['default'] = default_font
@@ -1067,7 +1067,7 @@
 cached_font = self.fonts.get(basename)
 if cached_font is None:
 fname = os.path.join(self.basepath, basename + ".afm")
- cached_font = AFM(file(fname, 'r'))
+ cached_font = AFM(open(fname, 'r'))
 cached_font.fname = fname
 self.fonts[basename] = cached_font
 self.fonts[cached_font.get_fontname()] = cached_font
Modified: branches/py3k/lib/matplotlib/mlab.py
===================================================================
--- branches/py3k/lib/matplotlib/mlab.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/mlab.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -785,7 +785,7 @@
 - *fracVar* : the fraction of the variance accounted for by each
 component returned
 
- A similar function of the same name was in the MATLAB 
+ A similar function of the same name was in the MATLAB
 R13 Neural Network Toolbox but is not found in later versions;
 its successor seems to be called "processpcs".
 """
@@ -1337,7 +1337,7 @@
 import gzip
 fh = gzip.open(fname,'wb')
 else:
- fh = file(fname,'w')
+ fh = open(fname,'w')
 elif hasattr(fname, 'seek'):
 fh = fname
 else:
Modified: branches/py3k/lib/matplotlib/texmanager.py
===================================================================
--- branches/py3k/lib/matplotlib/texmanager.py	2010年07月14日 20:02:25 UTC (rev 8551)
+++ branches/py3k/lib/matplotlib/texmanager.py	2010年07月15日 03:34:32 UTC (rev 8552)
@@ -228,7 +228,7 @@
 """
 basefile = self.get_basefile(tex, fontsize)
 texfile = '%s.tex'%basefile
- fh = file(texfile, 'w')
+ fh = open(texfile, 'w')
 custom_preamble = self.get_custom_preamble()
 fontcmd = {'sans-serif' : r'{\sffamily %s}',
 'monospace' : r'{\ttfamily %s}'}.get(self.font_family,
@@ -280,7 +280,7 @@
 """
 basefile = self.get_basefile(tex, fontsize)
 texfile = '%s.tex'%basefile
- fh = file(texfile, 'w')
+ fh = open(texfile, 'w')
 custom_preamble = self.get_custom_preamble()
 fontcmd = {'sans-serif' : r'{\sffamily %s}',
 'monospace' : r'{\ttfamily %s}'}.get(self.font_family,
@@ -356,7 +356,7 @@
 mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 try:
- fh = file(outfile)
+ fh = open(outfile)
 report = fh.read()
 fh.close()
 except IOError:
@@ -402,7 +402,7 @@
 mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 try:
- fh = file(outfile)
+ fh = open(outfile)
 report = fh.read()
 fh.close()
 
@@ -448,7 +448,7 @@
 mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 try:
- fh = file(outfile)
+ fh = open(outfile)
 report = fh.read()
 fh.close()
 except IOError:
@@ -481,7 +481,7 @@
 os.path.split(dvifile)[-1], outfile))
 mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
- fh = file(outfile)
+ fh = open(outfile)
 if exit_status:
 raise RuntimeError('dvipng was not able to \
 process the flowing file:\n%s\nHere is the full report generated by dvipng: \
@@ -498,7 +498,7 @@
 rendering of the tex string
 """
 psfile = self.make_ps(tex, fontsize)
- ps = file(psfile)
+ ps = open(psfile)
 for line in ps:
 if line.startswith('%%BoundingBox:'):
 return [int(val) for val in line.split()[1:]]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /