Skip to content

Commit

Permalink
MAINT Lint - fix ast node type in docstrings (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyleeow authored Aug 18, 2023
1 parent b927883 commit 84a98a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sphinx_gallery/backreferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def identify_names(script_blocks, ref_regex, global_variables=None, node=""):
example_globals: Optional[Dict[str, Any]]
Global variables for examples. Default=None
node : ast.Module or str
The parsed node. Default=""
The parsed node. Default="".
Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion sphinx_gallery/gen_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def generate_dir_rst(
seen_backrefs: set,
Back references encountered when parsing this gallery
will be stored in this set.
include_toctree: bool,
include_toctree: bool
Whether or not toctree should be included
in generated rst file.
Default = True.
Expand Down
9 changes: 5 additions & 4 deletions sphinx_gallery/py_source_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def _get_docstring_and_rest(filename):
``filename`` content without the docstring
lineno : int
The line number.
node : ast Node
The node.
node : ast.Module
The ast node. When `filename` parsed with `mode='exec' node should be
of type `ast.Module`.
"""
node, content = parse_source_file(filename)

Expand Down Expand Up @@ -167,8 +168,8 @@ def split_code_and_text_blocks(source_file, return_node=False):
(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.
node : ast Node
The parsed node.
node : ast.Module
The parsed ast node.
"""
docstring, rest_of_content, lineno, node = _get_docstring_and_rest(source_file)
blocks = [("text", docstring, 1)]
Expand Down

0 comments on commit 84a98a9

Please sign in to comment.