From 149e76b9dfd4801ee752cef5513b88e408bf7119 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 14 Dec 2014 08:26:06 -0500 Subject: Move some code, and fix pep8 things --- coverage/backward.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 030d336e..f9402f41 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -5,7 +5,9 @@ # pylint: disable=unused-import # pylint: disable=no-name-in-module -import os, re, sys +import os +import re +import sys # Pythons 2 and 3 differ on where to get StringIO. try: @@ -50,17 +52,6 @@ else: """Produce the items from dict `d`.""" return d.iteritems() -# Reading Python source and interpreting the coding comment is a big deal. -if sys.version_info >= (3, 0): - # Python 3.2 provides `tokenize.open`, the best way to open source files. - import tokenize - open_python_source = tokenize.open -else: - def open_python_source(fname): - """Open a source file the best way.""" - return open(fname, "rU") - - # Python 3.x is picky about bytes and strings, so provide methods to # get them right, and make them no-ops in 2.x if sys.version_info >= (3, 0): @@ -118,7 +109,8 @@ except KeyError: # imp was deprecated in Python 3.3 try: - import importlib, importlib.util + import importlib + import importlib.util imp = None except ImportError: importlib = None -- cgit v1.2.1