def visit_functiondef(self, ast: ast_node.FunctionDef): args = ast.argnames() ret_type = " -> %s" % ast.returns.as_string() if ast.returns else "" modifier = "" if ast.is_abstract(): modifier += "{abstract} " if ast.type in {"classmethod", "staticmethod"}: modifier += "{static} " self.write("%s%s(%s)%s" % (modifier, ast.name, ','.join(args), ret_type))
def _check_first_arg_for_type(self, node: nodes.FunctionDef) -> None: """Check the name of first argument.""" # pylint: disable=duplicate-code if node.args.posonlyargs: first_arg = node.args.posonlyargs[0].name elif node.args.args: first_arg = node.argnames()[0] else: first_arg = None self._first_attrs.append(first_arg) # static method if node.type == "staticmethod": self._first_attrs[-1] = None