class documentation

class NodeMatcher:

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 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):

Undocumented

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

Undocumented

Parameters
*node​_classes:Type[Node]Undocumented
**attrs:AnyUndocumented
def match(self, node):

Undocumented

Parameters
node:NodeUndocumented
Returns
boolUndocumented
attrs =

Undocumented

classes =

Undocumented