sphinx-autoapi
sphinx-autoapi copied to clipboard
`duplicate object description` when redefing variable with `if` block
Especially it is raised when trying generate docs for conf.py
in RTD, because RTD modify conf.py
.
# conf.py while RTD generating docs
...
html_static_path = ["_static"]
...
###########################################################################
# auto-created readthedocs.org specific configuration #
###########################################################################
...
# Add RTD Static Path. Add to the end because it overwrites previous files.
if not 'html_static_path' in globals():
html_static_path = []
if os.path.exists('_static'):
html_static_path.append('_static')
...
I found that error happens here. There is no parse_if
method so it is just ignoring if
block.
node.test.bool_value()
returning result of the statement (see docs).
So, you need to write method parse_if
, but what the logic should implement this method? There is two variants:
- Ignore all
if
statements. -
if not node.test.bool_value() or node.test.bool_value() is "Uninferable":
ignore block. And if not, redef all what in statement.
Before creating PR, I need to solve two problems: what I should return and how redef something. Would be nice if someone give some tip.
I make it work! In some time will make PR.