From d0e95e510f5fa73f81fc9a2ed6fc4f925f6c6460 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 28 Dec 2014 10:09:09 -0500 Subject: Further consolidation of code reading Python source. --- coverage/phystokens.py | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'coverage/phystokens.py') diff --git a/coverage/phystokens.py b/coverage/phystokens.py index f3f633d..c52e28a 100644 --- a/coverage/phystokens.py +++ b/coverage/phystokens.py @@ -262,19 +262,3 @@ if sys.version_info >= (3, 0): source_encoding = _source_encoding_py3 else: source_encoding = _source_encoding_py2 - - -def read_python_source(filename): - """Read the Python source text from `filename`. - - Returns unicode on Python 3, bytes on Python 2. - - """ - # Python 3.2 provides `tokenize.open`, the best way to open source files. - if sys.version_info >= (3, 2): - f = tokenize.open(filename) - else: - f = open(filename, "rU") - - with f: - return f.read() -- cgit v1.2.1