diff options
| author | Georg Brandl <georg@python.org> | 2011-01-08 18:44:06 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2011-01-08 18:44:06 +0100 |
| commit | be5da964de291d35a685bb4a52c46aa07af3fb2b (patch) | |
| tree | 448b8576265dc98fd08e0a95b8cd5f7e869faf47 | |
| parent | d599a3942d8a0172277001433eb5efd05b6a6a81 (diff) | |
| parent | 41aa9b9e962403f7e305309b4eff16cd770f6257 (diff) | |
| download | sphinx-be5da964de291d35a685bb4a52c46aa07af3fb2b.tar.gz | |
merge with https://bitbucket.org/langacore/sphinx
| -rw-r--r-- | CHANGES | 2 | ||||
| -rw-r--r-- | doc/config.rst | 8 | ||||
| -rw-r--r-- | sphinx/config.py | 1 | ||||
| -rw-r--r-- | sphinx/environment.py | 11 | ||||
| -rw-r--r-- | sphinx/ext/autodoc.py | 4 | ||||
| -rw-r--r-- | sphinx/util/inspect.py | 6 |
6 files changed, 27 insertions, 5 deletions
@@ -83,6 +83,8 @@ Release 1.1 (in development) * #590: Added ``caption`` option to graphviz directives. +* #537: Added :confval:`nitpick_ignore`. + * C++ domain now supports array definitions. diff --git a/doc/config.rst b/doc/config.rst index a1f550dd..36867469 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -232,6 +232,14 @@ General configuration .. versionadded:: 1.0 +.. confval:: nitpick_ignore + + A list of ``(type, target)`` tuples (by default empty) that should be ignored + when generating warnings in "nitpicky mode". Note that ``type`` should + include the domain name. An example entry would be ``('py:func', 'int')``. + + .. versionadded:: 1.1 + Project information ------------------- diff --git a/sphinx/config.py b/sphinx/config.py index 90c4b562..f4c0946b 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -71,6 +71,7 @@ class Config(object): primary_domain = ('py', 'env'), needs_sphinx = (None, None), nitpicky = (False, 'env'), + nitpick_ignore = ([], 'env'), # HTML options html_theme = ('default', 'html'), diff --git a/sphinx/environment.py b/sphinx/environment.py index 1f8e00f5..0867eb74 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -69,7 +69,7 @@ default_settings = { # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 40 +ENV_VERSION = 41 default_substitutions = set([ @@ -340,6 +340,9 @@ class BuildEnvironment: # this is to invalidate old pickles self.version = ENV_VERSION + # make this a set for faster testing + self._nitpick_ignore = set(self.config.nitpick_ignore) + # All "docnames" here are /-separated and relative and exclude # the source suffix. @@ -1465,7 +1468,11 @@ class BuildEnvironment: def _warn_missing_reference(self, fromdoc, typ, target, node, domain): warn = node.get('refwarn') if self.config.nitpicky: - warn = True # XXX process exceptions here + warn = True + if self._nitpick_ignore: + dtype = domain and '%s:%s' % (domain.name, typ) or typ + if (dtype, target) in self._nitpick_ignore: + warn = False if not warn: return refdoc = node.get('refdoc', fromdoc) diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 61b08273..39684136 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -27,8 +27,8 @@ from sphinx.pycode import ModuleAnalyzer, PycodeError from sphinx.application import ExtensionError from sphinx.util.nodes import nested_parse_with_titles from sphinx.util.compat import Directive -from sphinx.util.inspect import (getargspec, isdescriptor, safe_getmembers, - safe_getattr) +from sphinx.util.inspect import getargspec, isdescriptor, safe_getmembers, \ + safe_getattr from sphinx.util.pycompat import base_exception, class_types from sphinx.util.docstrings import prepare_docstring diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index c136393f..6b2beffa 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -9,9 +9,13 @@ :license: BSD, see LICENSE for details. """ -inspect = __import__('inspect') import sys +# this imports the standard library inspect module without resorting to +# relatively import this module +inspect = __import__('inspect') + + if sys.version_info >= (2, 5): from functools import partial def getargspec(func): |
