Fix issues linking to attributes on objects not specified in code.

Review Request #12536 — Created Aug. 15, 2022 and submitted

chipx86
beanbag-docutils
master
beanbag-misc

The new AST-based GitHub line resolver had an assert that tried to
ensure we were at the end of a lookup path when returning a final
result. There are actually cases where this is expected. For example, if
defining a namedtuple in code, Sphinx will (unless otherwise
specified) introspect some of the auto-generated attributes and methods,
which are auto-generated. This means there's no actual code defining
those to link to.

Rather than assert, we now assume that we're at the final result and
return it as-is.

We also bullet-proof the Assign(targets=...) lookup. The assumption
was made that each item would have an id attribute, but that's not
always the case. We now filter those out.

Unit tests pass on Python 3.6-3.11.

Built the Djblets documentation. Verified the errors went away, and that
the lines being referenced now link to the most-relevant lines in the
source.

Summary
Fix issues linking to attributes on objects not specified in code.
david
  1. 
      
  2. Nit: matters -> matter

  3. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (ba84f63)
Loading...