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 | 8d10339238d0115225245d2b9a90579f329ec22f (patch) | |
tree | bfd29ff5b9c36ff63ab617882c48840c9956c0ee /coverage/backward.py | |
parent | 52f0f80fb552789c79d536a8aca265da04143a58 (diff) | |
download | python-coveragepy-8d10339238d0115225245d2b9a90579f329ec22f.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 030d336..f9402f4 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 |