summaryrefslogtreecommitdiff
path: root/coverage/backward.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-09-20 13:11:50 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-09-20 13:11:50 -0400
commit873c344d6dcc54d9b0a7a5426067e5dad7a0e321 (patch)
treea12c2fb9c5f783fb373a4066383caaa035e77ee2 /coverage/backward.py
parentfa536eebceffff6960feb3e859bf40220fe71816 (diff)
downloadpython-coveragepy-873c344d6dcc54d9b0a7a5426067e5dad7a0e321.tar.gz
More things we don't need with the latest versions
Diffstat (limited to 'coverage/backward.py')
-rw-r--r--coverage/backward.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/coverage/backward.py b/coverage/backward.py
index 11f8e00..9597449 100644
--- a/coverage/backward.py
+++ b/coverage/backward.py
@@ -50,22 +50,7 @@ else:
if sys.version_info >= (3, 0):
# Python 3.2 provides `tokenize.open`, the best way to open source files.
import tokenize
- try:
- open_python_source = tokenize.open # pylint: disable=E1101
- except AttributeError:
- from io import TextIOWrapper
- detect_encoding = tokenize.detect_encoding # pylint: disable=E1101
- # Copied from the 3.2 stdlib:
- def open_python_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
+ open_python_source = tokenize.open # pylint: disable=E1101
else:
def open_python_source(fname):
"""Open a source file the best way."""