class documentation

class NodeMatcher: (source)

View In Hierarchy

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 __future__ import annotations 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
def __call__(self, node): (source)

Undocumented

Parameters
node:NodeUndocumented
Returns
boolUndocumented
def __init__(self, *node_classes, **attrs): (source)

Undocumented

Parameters
*node_classes:type[Node]Undocumented
**attrs:AnyUndocumented
def match(self, node): (source)

Undocumented

Parameters
node:NodeUndocumented
Returns
boolUndocumented

Undocumented

Undocumented