Skip to content

Commit

Permalink
let dynamic function docstrings take precedence over static ones, fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Apr 24, 2023
1 parent c539e11 commit 0f8bc66
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<!-- ✨ You do not need to add a pull request reference or an author, this will be added automatically by CI. ✨ -->

- Fix rendering of dynamically modified docstrings.
- `pdoc.doc_ast.AstInfo` now has separate `func_docstrings` and `var_docstrings` attributes
instead of one combined one.

Expand Down
2 changes: 1 addition & 1 deletion pdoc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def members(self) -> dict[str, Doc]:
)
if self._var_docstrings.get(name):
doc.docstring = self._var_docstrings[name]
if self._func_docstrings.get(name):
if self._func_docstrings.get(name) and not doc.docstring:
doc.docstring = self._func_docstrings[name]
members[doc.name] = doc

Expand Down
Loading

0 comments on commit 0f8bc66

Please # to comment.