module documentation

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

Unknown Field: copyright
Copyright 2007-2022 by the Sphinx team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Constant IS​_SPEEDUP Undocumented
Constant VERSIONING​_RATIO Undocumented
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
IS_SPEEDUP: bool =

Undocumented

Value
False
VERSIONING_RATIO: int =

Undocumented

Value
65
def add_uids(doctree, condition):
Add a unique id to every node in the doctree which matches the condition and yield the nodes.
Parameters
doctree:NodeA docutils.nodes.document instance.
condition:AnyA callable which returns either True or False for a given node.
Returns
Iterator[Node]Undocumented
def get_ratio(old, new):
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):
Return the Levenshtein edit distance between two strings a and b.
Parameters
a:strUndocumented
b:strUndocumented
Returns
intUndocumented
def merge_doctrees(old, new, condition):

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.

Parameters
old:NodeUndocumented
new:NodeUndocumented
condition:AnyA callable which returns either True or False for a given node.
Returns
Iterator[Node]Undocumented
def setup(app):

Undocumented

Parameters
app:SphinxUndocumented
Returns
Dict[str, Any]Undocumented