sphinx-autoapi icon indicating copy to clipboard operation
sphinx-autoapi copied to clipboard

`duplicate object description` when redefing variable with `if` block

Open PerchunPak opened this issue 2 years ago • 2 comments

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')
...

Sample build from my prod.

PerchunPak avatar Apr 27 '22 08:04 PerchunPak

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:

  1. Ignore all if statements.
  2. 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.

PerchunPak avatar Apr 27 '22 10:04 PerchunPak

I make it work! In some time will make PR.

PerchunPak avatar Apr 27 '22 11:04 PerchunPak