(self, modname, parents, path, base)
| 535 | # |
| 536 | # return modname, mod_cls + [base] |
| 537 | def resolve_name(self, modname, parents, path, base): |
| 538 | if modname is None: |
| 539 | if path: |
| 540 | mod_cls = path.rstrip(".") |
| 541 | else: |
| 542 | mod_cls = None |
| 543 | # if documenting a class-level object without path, |
| 544 | # there must be a current class, either from a parent |
| 545 | # auto directive ... |
| 546 | mod_cls = self.env.temp_data.get("autodoc:class") |
| 547 | # ... or from a class directive |
| 548 | if mod_cls is None: |
| 549 | mod_cls = self.env.temp_data.get("py:class") |
| 550 | # ... if still None, there's no way to know |
| 551 | if mod_cls is None: |
| 552 | return None, [] |
| 553 | # HACK: this is added in comparison to ClassLevelDocumenter |
| 554 | # mod_cls still exists of class.accessor, so an extra |
| 555 | # rpartition is needed |
| 556 | modname, _, accessor = mod_cls.rpartition(".") |
| 557 | modname, _, cls = modname.rpartition(".") |
| 558 | parents = [cls, accessor] |
| 559 | # if the module name is still missing, get it like above |
| 560 | if not modname: |
| 561 | modname = self.env.temp_data.get("autodoc:module") |
| 562 | if not modname: |
| 563 | if sphinx.__version__ > "1.3": |
| 564 | modname = self.env.ref_context.get("py:module") |
| 565 | else: |
| 566 | modname = self.env.temp_data.get("py:module") |
| 567 | # ... else, it stays None, which means invalid |
| 568 | return modname, [*parents, base] |
| 569 | |
| 570 | |
| 571 | class AccessorAttributeDocumenter(AccessorLevelDocumenter, AttributeDocumenter): |
nothing calls this directly
no test coverage detected