summaryrefslogtreecommitdiffstats
path: root/myst_parser/_compat.py
blob: d29cf4d8600bb23f0b8ef68b9d617c7b75796e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
"""Helpers for cross compatibility across dependency versions."""
from typing import Callable, Iterable

from docutils.nodes import Element


def findall(node: Element) -> Callable[..., Iterable[Element]]:
    """Iterate through"""
    # findall replaces traverse in docutils v0.18
    # note a difference is that findall is an iterator
    return getattr(node, "findall", node.traverse)