summaryrefslogtreecommitdiff
path: root/coverage/backward.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-03-25 00:21:50 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-03-25 00:21:50 -0400
commit6fd70326cce88970fb651ee29948c2f37792bc54 (patch)
tree675f77d865e1988c1c35325b7047ae0ebd60b1d7 /coverage/backward.py
parentcfa0e6044634aadb62c97a3920e60fb79fe4b6b3 (diff)
downloadpython-coveragepy-6fd70326cce88970fb651ee29948c2f37792bc54.tar.gz
Remove obsolete code paths.
Diffstat (limited to 'coverage/backward.py')
-rw-r--r--coverage/backward.py33
1 files changed, 13 insertions, 20 deletions
diff --git a/coverage/backward.py b/coverage/backward.py
index 236bef8..637a597 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -79,26 +79,19 @@ if sys.version_info >= (3, 0):
try:
open_source = tokenize.open # pylint: disable=E1101
except AttributeError:
- try:
- detect_encoding = tokenize.detect_encoding # pylint: disable=E1101
- except AttributeError:
- assert 3 == 4
- def open_source(fname):
- """Open a source file the best way."""
- return open(fname, "rU")
- else:
- from io import TextIOWrapper
- # Copied from the 3.2 stdlib:
- def open_source(fname):
- """Open a file in read only mode using the encoding detected by
- detect_encoding().
- """
- buffer = open(fname, 'rb')
- encoding, _ = detect_encoding(buffer.readline)
- buffer.seek(0)
- text = TextIOWrapper(buffer, encoding, line_buffering=True)
- text.mode = 'r'
- return text
+ from io import TextIOWrapper
+ detect_encoding = tokenize.detect_encoding # pylint: disable=E1101
+ # Copied from the 3.2 stdlib:
+ def open_source(fname):
+ """Open a file in read only mode using the encoding detected by
+ detect_encoding().
+ """
+ buffer = open(fname, 'rb')
+ encoding, _ = detect_encoding(buffer.readline)
+ buffer.seek(0)
+ text = TextIOWrapper(buffer, encoding, line_buffering=True)
+ text.mode = 'r'
+ return text
else:
def open_source(fname):
"""Open a source file the best way."""