summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/control.py3
-rw-r--r--coverage/files.py7
-rw-r--r--coverage/phystokens.py12
-rw-r--r--coverage/plugin.py36
-rw-r--r--coverage/plugin_support.py13
-rw-r--r--coverage/python.py1
-rw-r--r--doc/conf.py1
-rw-r--r--doc/requirements.txt1
-rw-r--r--tests/test_process.py15
9 files changed, 33 insertions, 56 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 13261de2..a9d5cb4d 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -736,8 +736,7 @@ class Coverage(object):
Also warn about various problems collecting data.
- Returns:
- :class:`CoverageData`: the collected coverage data.
+ Returns a :class:`CoverageData`, the collected coverage data.
"""
self._init()
diff --git a/coverage/files.py b/coverage/files.py
index 762445fd..bc9b0c9a 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -295,10 +295,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. If a mapping has happened, this is a
- canonical path. If no mapping has happened, it is the
- original value of `path` unchanged.
+ Returns the mapped path. If a mapping has happened, this is a
+ canonical path. If no mapping has happened, it is the original value
+ of `path` unchanged.
"""
for regex, result, pattern_sep, result_sep in self.aliases:
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index 7a033aec..92da8d32 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -158,11 +158,9 @@ COOKIE_RE = re.compile(r"^\s*#.*coding[:=]\s*([-\w.]+)", flags=re.MULTILINE)
def _source_encoding_py2(source):
"""Determine the encoding for `source`, according to PEP 263.
- Arguments:
- source (byte string): the text of the program.
+ `source` is a byte string, the text of the program.
- Returns:
- string: the name of the encoding.
+ Returns a string, the name of the encoding.
"""
assert isinstance(source, bytes)
@@ -255,11 +253,9 @@ def _source_encoding_py2(source):
def _source_encoding_py3(source):
"""Determine the encoding for `source`, according to PEP 263.
- Arguments:
- source (byte string): the text of the program.
+ `source` is a byte string: the text of the program.
- Returns:
- string: the name of the encoding.
+ Returns a string, the name of the encoding.
"""
readline = iternext(source.splitlines(True))
diff --git a/coverage/plugin.py b/coverage/plugin.py
index c039f817..62cc6dce 100644
--- a/coverage/plugin.py
+++ b/coverage/plugin.py
@@ -42,14 +42,12 @@ class CoveragePlugin(object):
trace the file or not. Be prepared for `filename` to refer to all
kinds of files that have nothing to do with your plugin.
- Arguments:
- filename (str): The path to the file being considered. This is the
- absolute real path to the file. If you are comparing to other
- paths, be sure to take this into account.
+ `filename` is a string, the path to the file being considered. This is
+ the absolute real path to the file. If you are comparing to other
+ paths, be sure to take this into account.
- Returns:
- FileTracer: the :class:`FileTracer` object to use to trace
- `filename`, or None if this plugin cannot trace this file.
+ Returns a :class:`FileTracer` object to use to trace `filename`, or
+ None if this plugin cannot trace this file.
"""
return None
@@ -91,8 +89,7 @@ class FileTracer(object):
to own the mapping from Python execution back to whatever source
filename was originally the source of the code.
- Returns:
- The filename to credit with this execution.
+ Returns the filename to credit with this execution.
"""
_needs_to_implement(self, "source_filename")
@@ -102,13 +99,12 @@ class FileTracer(object):
FileTracers can provide dynamically determined filenames by
implementing dynamic_source_filename. Invoking that function is
- expensive. To determine whether to invoke it, coverage.py uses
- the result of this function to know if it needs to bother invoking
+ expensive. To determine whether to invoke it, coverage.py uses the
+ result of this function to know if it needs to bother invoking
:meth:`dynamic_source_filename`.
- Returns:
- boolean: True if :meth:`dynamic_source_filename` should be called
- to get dynamic source filenames.
+ Returns true if :meth:`dynamic_source_filename` should be called to get
+ dynamic source filenames.
"""
return False
@@ -122,9 +118,8 @@ class FileTracer(object):
This function will not be invoked if
:meth:`has_dynamic_source_filename` returns False.
- Returns:
- The source filename for this frame, or None if this frame shouldn't
- be measured.
+ Returns the source filename for this frame, or None if this frame
+ shouldn't be measured.
"""
return None
@@ -142,13 +137,6 @@ class FileTracer(object):
from the source file were executed. Return (-1, -1) in this case to
tell coverage.py that no lines should be recorded for this frame.
- Arguments:
- frame: the call frame to examine.
-
- Returns:
- int, int: a pair of line numbers, the start and end lines
- executed in the source, inclusive.
-
"""
lineno = frame.f_lineno
return lineno, lineno
diff --git a/coverage/plugin_support.py b/coverage/plugin_support.py
index 5c577be1..23c1bc1a 100644
--- a/coverage/plugin_support.py
+++ b/coverage/plugin_support.py
@@ -51,7 +51,8 @@ class Plugins(object):
def add_file_tracer(self, plugin):
"""Add a file tracer plugin.
- ``plugin`` must implement the :meth:`CoveragePlugin.file_tracer` method.
+ `plugin` is an instance of a third-party plugin class. It must
+ implement the :meth:`CoveragePlugin.file_tracer` method.
"""
self._add_plugin(plugin, self.file_tracers)
@@ -67,13 +68,8 @@ class Plugins(object):
def _add_plugin(self, plugin, specialized):
"""Add a plugin object.
- Arguments:
- plugin (CoveragePlugin): the plugin to add.
-
- specialized (list): the list of plugins to add this to.
-
- Returns:
- plugin: may be a different object than passed in.
+ `plugin` is a :class:`CoveragePlugin` instance to add. `specialized`
+ is a list to append the plugin to.
"""
plugin_name = "%s.%s" % (self.current_module, plugin.__class__.__name__)
@@ -89,7 +85,6 @@ class Plugins(object):
self.names[plugin_name] = plugin
if specialized is not None:
specialized.append(plugin)
- return plugin
def __nonzero__(self):
return bool(self.order)
diff --git a/coverage/python.py b/coverage/python.py
index 5c126c4e..94d20fd8 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -118,6 +118,7 @@ class PythonFileReporter(FileReporter):
@property
def parser(self):
+ """Lazily create a :class:`PythonParser`."""
if self._parser is None:
self._parser = PythonParser(
filename=self.filename,
diff --git a/doc/conf.py b/doc/conf.py
index 7be1ca79..de90dd74 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -31,7 +31,6 @@ extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.ifconfig',
- 'sphinxcontrib.napoleon',
'sphinxcontrib.spelling',
'px_xlator',
]
diff --git a/doc/requirements.txt b/doc/requirements.txt
index 3ae49210..81778351 100644
--- a/doc/requirements.txt
+++ b/doc/requirements.txt
@@ -1,5 +1,4 @@
# PyPI requirements for building documentation for coverage.py
pyenchant
sphinx
-sphinxcontrib-napoleon
sphinxcontrib-spelling
diff --git a/tests/test_process.py b/tests/test_process.py
index 3a05eaa5..8255f98c 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -845,15 +845,16 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
): # pragma: not covered
"""Run the test for a particular combination of factors.
- Arguments:
- dashm (str): Either "" (run the program as a file) or "-m" (run the
- program as a module).
+ The arguments are all strings:
- package (str): Either "" (put the source at the top level) or a
- package name to use to hold the source.
+ * `dashm`: Either "" (run the program as a file) or "-m" (run the
+ program as a module).
- source (str): Either "main" or "sub", which file to use as the
- ``--source`` argument.
+ * `package`: Either "" (put the source at the top level) or a
+ package name to use to hold the source.
+
+ * `source`: Either "main" or "sub", which file to use as the
+ ``--source`` argument.
"""
if env.METACOV: