module documentation

Implements the low-level algorithms Sphinx uses for versioning doctrees.

Class UIDTransform Add UIDs to doctree for versioning.
Function add_uids Add a unique id to every node in the `doctree` which matches the condition and yield the nodes.
Function get_ratio Return a "similarity ratio" (in percent) representing the similarity between the two strings where 0 is equal and anything above less than equal.
Function levenshtein_distance Return the Levenshtein edit distance between two strings *a* and *b*.
Function merge_doctrees Merge the `old` doctree with the `new` one while looking at nodes matching the `condition`.
Function setup Undocumented
Constant IS_SPEEDUP Undocumented
Constant VERSIONING_RATIO Undocumented
def add_uids(doctree, condition): (source)

Add a unique id to every node in the `doctree` which matches the condition and yield the nodes. :param doctree: A :class:`docutils.nodes.document` instance. :param condition: A callable which returns either ``True`` or ``False`` for a given node.

Parameters
doctree:NodeUndocumented
condition:AnyUndocumented
Returns
Iterator[Node]Undocumented
def get_ratio(old, new): (source)

Return a "similarity ratio" (in percent) representing the similarity between the two strings where 0 is equal and anything above less than equal.

Parameters
old:strUndocumented
new:strUndocumented
Returns
floatUndocumented
def levenshtein_distance(a, b): (source)

Return the Levenshtein edit distance between two strings *a* and *b*.

Parameters
a:strUndocumented
b:strUndocumented
Returns
intUndocumented
def merge_doctrees(old, new, condition): (source)

Merge the `old` doctree with the `new` one while looking at nodes matching the `condition`. Each node which replaces another one or has been added to the `new` doctree will be yielded. :param condition: A callable which returns either ``True`` or ``False`` for a given node.

Parameters
old:NodeUndocumented
new:NodeUndocumented
condition:AnyUndocumented
Returns
Iterator[Node]Undocumented
def setup(app): (source)

Undocumented

Parameters
app:SphinxUndocumented
Returns
dict[str, Any]Undocumented
IS_SPEEDUP: bool = (source)

Undocumented

Value
True
VERSIONING_RATIO: int = (source)

Undocumented

Value
65