diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-03 14:00:37 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-03 14:00:37 -0400 |
commit | d8c15614a64764ee4d30e3d19020a244e4778709 (patch) | |
tree | 4bde9d0b8f3366b61a58dfd4d8d79168c8a1c063 | |
parent | 09dd9334a2cc7976c1a42f795eba5864aaf930f0 (diff) | |
download | python-coveragepy-git-d8c15614a64764ee4d30e3d19020a244e4778709.tar.gz |
Add some docstrings
-rw-r--r-- | coverage/collector.py | 12 | ||||
-rw-r--r-- | coverage/data.py | 3 | ||||
-rw-r--r-- | coverage/plugin.py | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index 3f557aa5..57c35605 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -129,10 +129,12 @@ class Collector(object): def reset(self): """Clear collected data, and prepare to collect more.""" - # A dictionary mapping filenames to dicts with line number keys, - # or mapping filenames to dicts with line number pairs as keys. + # A dictionary mapping filenames to dicts with line number keys (if not + # branch coverage), or mapping filenames to dicts with line number + # pairs as keys (if branch coverage). self.data = {} + # A dictionary mapping filenames to plugin names that will handle them. self.plugin_data = {} # The .should_trace_cache attribute is a cache from filenames to @@ -322,4 +324,10 @@ class Collector(object): return {} def get_plugin_data(self): + """Return the mapping of source files to plugins. + + Returns: + dict: { filename: plugin_name, ... } + + """ return self.plugin_data diff --git a/coverage/data.py b/coverage/data.py index 22b711d1..59ebae2f 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -24,8 +24,6 @@ class CoverageData(object): * plugins: a dict mapping filenames to plugin names: { 'file1': "django.coverage", ... } - # TODO: how to handle the difference between a plugin module - # name, and the class in the module? """ @@ -126,6 +124,7 @@ class CoverageData(object): ) def plugin_data(self): + """Return the map from filenames to plugin names.""" return self.plugins def write_file(self, filename): diff --git a/coverage/plugin.py b/coverage/plugin.py index 3fbb43aa..678d297a 100644 --- a/coverage/plugin.py +++ b/coverage/plugin.py @@ -171,11 +171,7 @@ class FileReporter(object): self.filename = filename def __repr__(self): - return ( - # pylint: disable=redundant-keyword-arg - "<{self.__class__.__name__}" - " filename={self.filename!r}>".format(self=self) - ) + return "<{0.__class__.__name__} filename={0.filename!r}>".format(self) def relative_filename(self): return files.relative_filename(self.filename) |