diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2014-03-22 15:37:01 +0100 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2014-03-22 15:37:01 +0100 |
commit | 427b791cead0b4137c7d7d2e1c7f915f611f47a1 (patch) | |
tree | 1054e61c932c4f4380117c2572a8c60a16f26df2 | |
parent | f4c674a3a6e80c902147b5bb61ceb176dde0fd4a (diff) | |
download | pyflakes-427b791cead0b4137c7d7d2e1c7f915f611f47a1.tar.gz |
Silence the DeprecationWarning about universal newline mode
-rw-r--r-- | pyflakes/api.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pyflakes/api.py b/pyflakes/api.py index b132566..62e5779 100644 --- a/pyflakes/api.py +++ b/pyflakes/api.py @@ -13,6 +13,8 @@ from pyflakes import reporter as modReporter __all__ = ['check', 'checkPath', 'checkRecursive', 'iterSourceCode', 'main'] +universal_newline = ('U' if sys.version_info < (3, 0) else 'r') + def check(codeString, filename, reporter=None): """ @@ -74,7 +76,7 @@ def checkPath(filename, reporter=None): if reporter is None: reporter = modReporter._makeDefaultReporter() try: - with open(filename, 'U') as f: + with open(filename, universal_newline) as f: codestr = f.read() + '\n' except UnicodeError: reporter.unexpectedError(filename, 'problem decoding source') |