sphinx_gallery.py_source_parser¶
Parser for python source files¶
Functions¶
-
sphinx_gallery.py_source_parser.extract_file_config(content)¶ Pull out the file-specific config specified in the docstring.
-
sphinx_gallery.py_source_parser.get_docstring_and_rest(filename)¶ Separate
filenamecontent between docstring and the restStrongly inspired from ast.get_docstring.
Returns: - docstring (str) – docstring of
filename - rest (str) –
filenamecontent without the docstring
- docstring (str) – docstring of
-
sphinx_gallery.py_source_parser.parse_source_file(filename)¶ Parse source file into AST node
Parameters: filename (str) – File path Returns: - node (AST node)
- content (utf-8 encoded string)
-
sphinx_gallery.py_source_parser.split_code_and_text_blocks(source_file)¶ Return list with source file separated into code and text blocks.
Returns: - file_conf (dict) – File-specific settings given in comments as:
# sphinx_gallery_<name> = <value> - blocks (list of (label, content)) – List where each element is a tuple with the label (‘text’ or ‘code’), and content string of block.
- file_conf (dict) – File-specific settings given in comments as: