sphinx_gallery.backreferences#

Backreferences Generator.

Parses example file code in order to keep track of used functions.

Functions#

sphinx_gallery.backreferences.identify_names(script_blocks, ref_regex, global_variables=None, node='')[source]#

Build a codeobj summary by identifying and resolving used names.

Parameters:
  • script_blocks (list) – (label, content, line_number) List where each element is a tuple with the label (‘text’ or ‘code’), the corresponding content string of block and the leading line number.

  • ref_regex (str) – Regex to find references to python objects.

  • example_globals (Optional[Dict[str, Any]]) – Global variables for examples. Default=None

  • node (ast.Module or str) – The parsed node. Default=””.

Returns:

example_code_obj – OrderedDict with information about all code object references found in an example. OrderedDict contains the following keys:

  • example_code_obj[‘name’] : function or class name (str)

  • example_code_obj[‘module’] : module name (str)

  • example_code_obj[‘module_short’] : shortened module name (str)

  • example_code_obj[‘is_class’] : whether object is class (bool)

  • example_code_obj[‘is_explicit’]whether object is an explicit

    backreference (referred to by sphinx markup) (bool)

Return type:

OrderedDict[str, Any]

Classes#

class sphinx_gallery.backreferences.DummyClass[source]#

Dummy class for testing method resolution.

property prop#

Property.

run()[source]#

Do nothing.