From 3a96ce659112fc3ec34c4b92d4b924c78292dbf4 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 9 Dec 2018 14:45:33 -0800 Subject: [PATCH] Deprecate unused and untested sphinx.util functions sphinx.util.attrdict: Last use removed in b09e628b0f33614e81521ad60e94472a0db09a4d. sphinx.util.PeekableIterator: Last use removed in 85b8a451a696c13d4644d4da900c2bcb31de4010. --- CHANGES | 2 ++ doc/extdev/index.rst | 10 ++++++++++ sphinx/util/__init__.py | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/CHANGES b/CHANGES index fe6f38b14..eeda56fc9 100644 --- a/CHANGES +++ b/CHANGES @@ -50,9 +50,11 @@ Deprecated * ``sphinx.ext.doctest.doctest_encode()`` * ``sphinx.io.SphinxRSTFileInput`` * ``sphinx.testing.util.remove_unicode_literal()`` +* ``sphinx.util.attrdict`` * ``sphinx.util.force_decode()`` * ``sphinx.util.get_matching_docs()`` is deprecated * ``sphinx.util.osutil.walk()`` +* ``sphinx.util.PeekableIterator`` * ``sphinx.util.pycompat.u`` * ``sphinx.writers.latex.LaTeXTranslator.babel_defmacro()`` * ``sphinx.writers.latex.TextTranslator._make_visit_admonition()`` diff --git a/doc/extdev/index.rst b/doc/extdev/index.rst index af19f9953..eb6416591 100644 --- a/doc/extdev/index.rst +++ b/doc/extdev/index.rst @@ -162,6 +162,11 @@ The following is a list of deprecated interfaces. - 4.0 - N/A + * - ``sphinx.util.attrdict`` + - 2.0 + - 4.0 + - N/A + * - ``sphinx.util.force_decode()`` - 2.0 - 4.0 @@ -182,6 +187,11 @@ The following is a list of deprecated interfaces. - 4.0 - N/A + * - ``sphinx.util.PeekableIterator`` + - 2.0 + - 4.0 + - N/A + * - ``sphinx.application.Sphinx._setting_up_extension`` - 2.0 - 3.0 diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 459434804..b228ca182 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -499,6 +499,11 @@ def force_decode(string, encoding): class attrdict(dict): + def __init__(self, *args, **kwargs): + super(attrdict, self).__init__(*args, **kwargs) + warnings.warn('The attrdict class is deprecated.', + RemovedInSphinx40Warning, stacklevel=2) + def __getattr__(self, key): # type: (unicode) -> unicode return self[key] @@ -573,6 +578,8 @@ class PeekableIterator: # type: (Iterable) -> None self.remaining = deque() # type: deque self._iterator = iter(iterable) + warnings.warn('PeekableIterator is deprecated.', + RemovedInSphinx40Warning, stacklevel=2) def __iter__(self): # type: () -> PeekableIterator