mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: autodoc: minor fix
This commit is contained in:
parent
55c110f609
commit
385f9f5c19
@ -1850,9 +1850,9 @@ class DataDocumenter(GenericAliasMixin, NewTypeMixin, TypeVarMixin,
|
|||||||
|
|
||||||
analyzer = ModuleAnalyzer.for_module(self.modname)
|
analyzer = ModuleAnalyzer.for_module(self.modname)
|
||||||
analyzer.analyze()
|
analyzer.analyze()
|
||||||
for (classname, attrname) in analyzer.annotations:
|
for (classname, attrname), annotation in analyzer.annotations.items():
|
||||||
if classname == '' and attrname not in annotations:
|
if classname == '' and attrname not in annotations:
|
||||||
annotations[attrname] = analyzer.annotations[classname, attrname] # type: ignore # NOQA
|
annotations[attrname] = annotation # type: ignore
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2286,9 +2286,9 @@ class AttributeDocumenter(GenericAliasMixin, NewTypeMixin, SlotsMixin, # type:
|
|||||||
|
|
||||||
analyzer = ModuleAnalyzer.for_module(module)
|
analyzer = ModuleAnalyzer.for_module(module)
|
||||||
analyzer.analyze()
|
analyzer.analyze()
|
||||||
for (classname, attrname) in analyzer.annotations:
|
for (classname, attrname), annotation in analyzer.annotations.items():
|
||||||
if classname == qualname and attrname not in annotations:
|
if classname == qualname and attrname not in annotations:
|
||||||
annotations[attrname] = analyzer.annotations[classname, attrname] # type: ignore # NOQA
|
annotations[attrname] = annotation # type: ignore
|
||||||
except (AttributeError, PycodeError):
|
except (AttributeError, PycodeError):
|
||||||
pass
|
pass
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
Loading…
Reference in New Issue
Block a user