diff options
author | Daniel Eades <danieleades@hotmail.com> | 2022-12-15 17:22:07 +0000 |
---|---|---|
committer | Jean-François B <2589111+jfbu@users.noreply.github.com> | 2022-12-16 16:50:24 +0100 |
commit | 1abb24e309c8189eca2663f77c3a3aa866633e12 (patch) | |
tree | e74425a4c2647b8a5c6c7c980f00235fc12491b5 /sphinx/pycode | |
parent | dc29bf9abef764460ec5ec1c1571bddce9a4f7fa (diff) | |
download | sphinx-git-1abb24e309c8189eca2663f77c3a3aa866633e12.tar.gz |
remove blanket 'noqas'
Diffstat (limited to 'sphinx/pycode')
-rw-r--r-- | sphinx/pycode/parser.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index 7861e6b0f..d64fb9282 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -59,7 +59,10 @@ def get_lvar_names(node: ast.AST, self: Optional[ast.arg] = None) -> List[str]: pass return members elif node_name == 'Attribute': - if node.value.__class__.__name__ == 'Name' and self and node.value.id == self_id: # type: ignore # NOQA + if ( + node.value.__class__.__name__ == 'Name' and # type: ignore[attr-defined] + self and node.value.id == self_id # type: ignore[attr-defined] + ): # instance variable return ["%s" % get_lvar_names(node.attr, self)[0]] # type: ignore else: @@ -344,7 +347,9 @@ class VariableCommentPicker(ast.NodeVisitor): """Handles Assign node and pick up a variable comment.""" try: targets = get_assign_targets(node) - varnames: List[str] = sum([get_lvar_names(t, self=self.get_self()) for t in targets], []) # NOQA + varnames: List[str] = sum( + [get_lvar_names(t, self=self.get_self()) for t in targets], [] + ) current_line = self.get_line(node.lineno) except TypeError: return # this assignment is not new definition! |