diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-06-13 21:44:43 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-06-13 21:44:43 -0400 |
commit | 6e5e9ae9d54e5fc1f4ac96c51344cb37c8ea3395 (patch) | |
tree | d571eb1991002a2c2c080cf847e4d3ebedcf54fc /coverage/files.py | |
parent | f230be76462efd15f48f216631f4d90db8d5685d (diff) | |
download | python-coveragepy-6e5e9ae9d54e5fc1f4ac96c51344cb37c8ea3395.tar.gz |
Remove FileLocator from PathAliases. Now it always produces canonicalized paths.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/coverage/files.py b/coverage/files.py index 665e2f3..c9afefd 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -237,12 +237,9 @@ class PathAliases(object): A `PathAliases` object tracks a list of pattern/result pairs, and can map a path through those aliases to produce a unified path. - `locator` is a FileLocator that is used to canonicalize the results. - """ - def __init__(self, locator=None): + def __init__(self): self.aliases = [] - self.locator = locator def add(self, pattern, result): """Add the `pattern`/`result` pair to the list of aliases. @@ -295,6 +292,9 @@ class PathAliases(object): The separator style in the result is made to match that of the result in the alias. + Returns: + The mapped path. This is always a canonical filename. + """ for regex, result, pattern_sep, result_sep in self.aliases: m = regex.match(path) @@ -302,8 +302,7 @@ class PathAliases(object): new = path.replace(m.group(0), result) if pattern_sep != result_sep: new = new.replace(pattern_sep, result_sep) - if self.locator: - new = self.locator.canonical_filename(new) + new = canonical_filename(new) return new return path |