diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-12-14 08:26:06 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-12-14 08:26:06 -0500 |
commit | 149e76b9dfd4801ee752cef5513b88e408bf7119 (patch) | |
tree | 0a1889e2900c0cde60758d93bc1ad7359e4d6279 /coverage/backward.py | |
parent | becff20dbf026e4e0f260b44a377c9083a8e0243 (diff) | |
download | python-coveragepy-git-149e76b9dfd4801ee752cef5513b88e408bf7119.tar.gz |
Move some code, and fix pep8 things
Diffstat (limited to 'coverage/backward.py')
-rw-r--r-- | coverage/backward.py | 18 |
1 files changed, 5 insertions, 13 deletions
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 |