refactor: autodoc: minor fix

This commit is contained in:
Takeshi KOMIYA 2020-12-17 21:59:09 +09:00
parent 55c110f609
commit 385f9f5c19

View File

@ -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: