[Numpy-svn] r4669 - trunk/numpy/lib
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Dec 30 06:10:46 EST 2007
Author: oliphant
Date: 2007-12-30 05:10:41 -0600 (Sun, 30 Dec 2007)
New Revision: 4669
Modified:
trunk/numpy/lib/io.py
trunk/numpy/lib/utils.py
Log:
Fix deprecate_with_doc and deprecate for builtin functions.
Modified: trunk/numpy/lib/io.py
===================================================================
--- trunk/numpy/lib/io.py 2007-12-30 09:59:39 UTC (rev 4668)
+++ trunk/numpy/lib/io.py 2007-12-30 11:10:41 UTC (rev 4669)
@@ -96,10 +96,15 @@
-------
result : array, tuple, dict, etc.
data stored in the file.
- If file contains pickle data, then whatever is stored in the pickle is returned.
+ If file contains pickle data, then whatever is stored in the pickle is
+ returned.
If the file is .npy file, then an array is returned.
- If the file is .npz file, then a dictionary-like object is returned which has a
- filename:array key:value pair for every file in the zip.
+ If the file is .npz file, then a dictionary-like object is returned
+ which has a filename:array key:value pair for every file in the zip.
+
+ Raises
+ ------
+ IOError
"""
if isinstance(file, type("")):
fid = _file(file,"rb")
Modified: trunk/numpy/lib/utils.py
===================================================================
--- trunk/numpy/lib/utils.py 2007-12-30 09:59:39 UTC (rev 4668)
+++ trunk/numpy/lib/utils.py 2007-12-30 11:10:41 UTC (rev 4669)
@@ -96,13 +96,16 @@
import warnings
if oldname is None:
- oldname = func.func_name
+ try:
+ oldname = func.func_name
+ except AttributeError:
+ oldname = func.__name__
if newname is None:
str1 = "%s is deprecated" % (oldname,)
- depdoc = "%s is DEPRECATED!" % (oldname,)
+ depdoc = "%s is DEPRECATED!!" % (oldname,)
else:
str1 = "%s is deprecated, use %s" % (oldname, newname),
- depdoc = '%s is DEPRECATED! -- use %s instead' % (oldname, newname,)
+ depdoc = '%s is DEPRECATED!! -- use %s instead' % (oldname, newname,)
def newfunc(*args,**kwds):
warnings.warn(str1, DeprecationWarning)
@@ -113,7 +116,7 @@
if doc is None:
doc = depdoc
else:
- doc = '\n'.join([depdoc, doc])
+ doc = '\n\n'.join([depdoc, doc])
newfunc.__doc__ = doc
try:
d = func.__dict__
@@ -128,7 +131,7 @@
with 'somestr' that is added to the functions docstring.
Example:
- depmsg = 'function numpy.lib.foo has been merged into numpy.lib.io.foobar'
+ depmsg = 'function scipy.foo has been merged into numpy.foobar'
@deprecate_with_doc(depmsg)
def foo():
pass
More information about the Numpy-svn
mailing list