Mypy 在方法签名上抛出无效语法

Mypy throws invalid syntax on method signature

在以下方法中调用的方法触发 mypytest_get_all_boards: test_get_all_boards invalid syntax mypy(error) 进行 lint。有问题的方法 returns 一个布尔值。我只明白 test_get_all_boards: 处的语法有什么问题。有什么想法吗?

@action(detail=False, methods=["post"])
def try_connection(self, request, *args, **kwargs):
    result = False
    cache = caches["instance_details"]

    if request.data:
        try:
            details = Jira(**request.data)
            if details:
                if cache[details.uuid]['valid_credentials']:
                    result = True
                else test_get_all_boards(details):
                    cache[details.uuid]['valid_credentials'] = True
                    result = True
        except:
            pass

    return Response({"test_result": result}, status=status.HTTP_200_OK)

关键字else和后面的“:”之间不应有任何内容。也许您的意思是改用 elif