class NodeMatcher:
A helper class for Node.findall().
It checks that the given node is an instance of the specified node-classes and has the specified node-attributes.
For example, following example searches reference node having refdomain and reftype attributes:
matcher = NodeMatcher(nodes.reference, refdomain='std', reftype='citation') doctree.findall(matcher) # => [<reference ...>, <reference ...>, ...]
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 matcher = NodeMatcher(nodes.reference, refdomain=Any) doctree.findall(matcher) # => [<reference ...>, <reference ...>, ...]
Method | __call__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | match |
Undocumented |
Instance Variable | attrs |
Undocumented |
Instance Variable | classes |
Undocumented |