From 2e37d40a9eceff624d27e25fe352c7e1855641d1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 30 Jan 2011 09:42:00 -0500 Subject: Isolate the open/tokenize.open distinction into backward.py --- coverage/backward.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 425bcc6..23c0a56 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -71,3 +71,13 @@ try: import configparser except ImportError: import ConfigParser as configparser + +# Python 3.2 provides `tokenize.open`, the best way to open source files. +try: + import tokenize + open_source = tokenize.open +except AttributeError: + def open_source(fname): + """Open a source file the best way.""" + return open(fname, "rU") + -- cgit v1.2.1 From ed554fe8552d3810252d485dd7ae4d4302822681 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 1 Feb 2011 22:46:41 -0500 Subject: Pylint 0.23.0 'deprecated' disable-msg. --- coverage/backward.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 23c0a56..1217e9e 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -1,7 +1,7 @@ """Add things to old Pythons so I can pretend they are newer.""" # This file does lots of tricky stuff, so disable a bunch of lintisms. -# pylint: disable-msg=F0401,W0611,W0622 +# pylint: disable=F0401,W0611,W0622 # F0401: Unable to import blah # W0611: Unused import blah # W0622: Redefining built-in blah -- cgit v1.2.1 From e349d6bc861910456ec9d74ad51d3a147b09a112 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 1 Feb 2011 22:55:51 -0500 Subject: Some pylint cleanups. --- coverage/backward.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 1217e9e..c363f21 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -75,7 +75,7 @@ except ImportError: # Python 3.2 provides `tokenize.open`, the best way to open source files. try: import tokenize - open_source = tokenize.open + open_source = tokenize.open # pylint: disable=E1101 except AttributeError: def open_source(fname): """Open a source file the best way.""" -- cgit v1.2.1