diff options
Diffstat (limited to 'sphinx/util/nodes.py')
-rw-r--r-- | sphinx/util/nodes.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index 9494b61de..4f1c2dac7 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -1,5 +1,7 @@ """Docutils node-related utility functions for Sphinx.""" +from __future__ import annotations + import re import unicodedata from typing import (TYPE_CHECKING, Any, Callable, Iterable, List, Optional, Set, Tuple, Type, @@ -45,7 +47,8 @@ class NodeMatcher: A special value ``typing.Any`` matches any kind of node-attributes. For example, following example searches ``reference`` node having ``refdomain`` attributes:: - from typing import Any + from __future__ import annotations +from typing import Any matcher = NodeMatcher(nodes.reference, refdomain=Any) doctree.findall(matcher) # => [<reference ...>, <reference ...>, ...] |