summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2010-11-10 14:50:13 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2010-11-10 14:50:13 +0100
commit710a3d8fd205b88c2ba4174e9eb564a1efae8234 (patch)
treeced7068c165b9fda95b350952e92fc7e8feff07d
parentc72f207e790f648ceba798b2c421e3216e8b3431 (diff)
downloadlogilab-common-710a3d8fd205b88c2ba4174e9eb564a1efae8234.tar.gz
fileutils: deprecate norm_read and norm_open
They have just simple builtin equivalent since python 2.3 (see commit 5b11fedb163f)
-rw-r--r--fileutils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/fileutils.py b/fileutils.py
index 2e81000..6aa2c76 100644
--- a/fileutils.py
+++ b/fileutils.py
@@ -36,6 +36,7 @@ from cStringIO import StringIO
from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS
from logilab.common.shellutils import find
+from logilab.common.deprecation import deprecated
from logilab.common.compat import FileIO, any
def first_level_directory(path):
@@ -253,7 +254,7 @@ def norm_read(path):
:return: the content of the file with normalized line feeds
"""
return open(path, 'U').read()
-
+norm_read = deprecated("use \"open(path, 'U').read()\"")(norm_read)
def norm_open(path):
"""Return a stream for a file with content with normalized line feeds.
@@ -265,7 +266,7 @@ def norm_open(path):
:return: the opened file with normalized line feeds
"""
return open(path, 'U')
-
+norm_open = deprecated("use \"open(path, 'U')\"")(norm_open)
def lines(path, comments=None):
"""Return a list of non empty lines in the file located at `path`.
@@ -285,7 +286,7 @@ def lines(path, comments=None):
:warning: at some point this function will probably return an iterator
"""
- stream = norm_open(path)
+ stream = open(path, 'U')
result = stream_lines(stream, comments)
stream.close()
return result