diff options
Diffstat (limited to 'sphinx/util/docfields.py')
-rw-r--r-- | sphinx/util/docfields.py | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index 561271c4f..cb11a799d 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -9,7 +9,6 @@ :license: BSD, see LICENSE for details. """ -import warnings from typing import Any, Dict, List, Tuple, Type, Union from typing import TYPE_CHECKING, cast @@ -17,7 +16,6 @@ from docutils import nodes from docutils.nodes import Node from sphinx import addnodes -from sphinx.deprecation import RemovedInSphinx40Warning from sphinx.util.typing import TextlikeNode if TYPE_CHECKING: @@ -217,26 +215,7 @@ class DocFieldTransformer: def __init__(self, directive: "ObjectDescription") -> None: self.directive = directive - try: - self.typemap = directive.get_field_type_map() - except Exception: - # for 3rd party extensions directly calls this transformer. - warnings.warn('DocFieldTransformer expects given directive object is a subclass ' - 'of ObjectDescription.', RemovedInSphinx40Warning) - self.typemap = self.preprocess_fieldtypes(directive.__class__.doc_field_types) - - def preprocess_fieldtypes(self, types: List[Field]) -> Dict[str, Tuple[Field, bool]]: - warnings.warn('DocFieldTransformer.preprocess_fieldtypes() is deprecated.', - RemovedInSphinx40Warning) - typemap = {} - for fieldtype in types: - for name in fieldtype.names: - typemap[name] = fieldtype, False - if fieldtype.is_typed: - typed_field = cast(TypedField, fieldtype) - for name in typed_field.typenames: - typemap[name] = typed_field, True - return typemap + self.typemap = directive.get_field_type_map() def transform_all(self, node: addnodes.desc_content) -> None: """Transform all field list children of a node.""" |