def _check_members_count(self, node: ModuleMembers) -> None: """This method increases the number of module members.""" parent = getattr(node, 'parent', None) is_real_method = is_method(getattr(node, 'function_type', None)) if isinstance(parent, ast.Module) and not is_real_method: self._public_items_count += 1
def check_arguments_count(self, node: AnyFunctionDefAndLambda) -> None: """Checks the number of the arguments in a function.""" has_extra_arg = 0 if functions.is_method(getattr(node, 'function_type', None)): has_extra_arg = 1 arguments = functions.get_all_arguments(node) self.arguments[node] = len(arguments) - has_extra_arg
def check_arguments_count(self, node: ast.FunctionDef) -> None: """Checks the number of the arguments in a function.""" counter = 0 has_extra_arg = 0 if is_method(getattr(node, 'function_type', None)): has_extra_arg = 1 counter += len(node.args.args) + len(node.args.kwonlyargs) if node.args.vararg: counter += 1 if node.args.kwarg: counter += 1 self.arguments[node] = counter - has_extra_arg