summaryrefslogtreecommitdiff
path: root/coverage/python.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-06-13 14:19:45 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-06-13 14:19:45 -0400
commitf9a5b120b91e62f86bcd12e54a92fda675534200 (patch)
treee5cc74f7da3d4220c3c313736f613c6c2e0b9638 /coverage/python.py
parent57ee6c36690e62698165e84d40614aa4f2cb7dc5 (diff)
downloadpython-coveragepy-git-f9a5b120b91e62f86bcd12e54a92fda675534200.tar.gz
Change FileLocator from a class to module-level functions
Diffstat (limited to 'coverage/python.py')
-rw-r--r--coverage/python.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/coverage/python.py b/coverage/python.py
index 69823da7..8dc163df 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -3,8 +3,7 @@
import os.path
import zipimport
-from coverage import env
-from coverage.files import FileLocator
+from coverage import env, files
from coverage.misc import contract, NoSource, join_regex
from coverage.parser import PythonParser
from coverage.phystokens import source_token_lines, source_encoding
@@ -85,7 +84,6 @@ class PythonFileReporter(FileReporter):
def __init__(self, morf, coverage=None):
self.coverage = coverage
- file_locator = coverage.file_locator if coverage else FileLocator()
if hasattr(morf, '__file__'):
filename = morf.__file__
@@ -98,15 +96,13 @@ class PythonFileReporter(FileReporter):
elif filename.endswith('$py.class'): # Jython
filename = filename[:-9] + ".py"
- super(PythonFileReporter, self).__init__(
- file_locator.canonical_filename(filename)
- )
+ super(PythonFileReporter, self).__init__(files.canonical_filename(filename))
if hasattr(morf, '__name__'):
name = morf.__name__
name = name.replace(".", os.sep) + ".py"
else:
- name = file_locator.relative_filename(filename)
+ name = files.relative_filename(filename)
self.name = name
self._source = None