0

Good day, sirs. The following error occurs when applying pyright.

/opt/homebrew/bin/pyright /Users/pli/Desktop/develop/app/application/router/test.py
/Users/pli/Desktop/develop/app/application/router/test.py
  /Users/pli/Desktop/develop/app/application/router/test.py:21:11 - error: "int" is not defined (reportUndefinedVariable)
  /Users/pli/Desktop/develop/app/application/router/test.py:22:16 - error: "int" is not defined (reportUndefinedVariable)
  /Users/pli/Desktop/develop/app/application/router/test.py:23:15 - error: "str" is not defined (reportUndefinedVariable)
  /Users/pli/Desktop/develop/app/application/router/test.py:24:13 - error: "str" is not defined (reportUndefinedVariable)
  /Users/pli/Desktop/develop/app/application/router/test.py:33:39 - error: "int" is not defined (reportUndefinedVariable)

/opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:363:54 - error: "frozenset" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:2850:15 - error: "frozenset" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:2854:12 - error: "frozenset" is not defined (reportUndefinedVariable)/opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:2920:15 - error: "type" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:3068:14 - error: "type" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:2929:22 - error: "type" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:488:16 - error: "type" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:2728:15 - error: "dict" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:1558:16 - error: "isinstance" is not defined (reportUndefinedVariable)
  /opt/homebrew/cellar/python@3.11/3.11.4_1/frameworks/python.framework/versions/3.11/lib/python3.11/typing.py:1561:18 - error: "tuple" is not defined (reportUndefinedVariable)

  1. reinstalled pyright via homebrew and applied it.
  2. reset the file watchers in the pycharm settings.

I was not getting any errors before, but suddenly started getting them.

+ test.py

from fastapi import APIRouter, Header, Query
...

router = APIRouter(tags=["Test"])

@router.get("/api/v1/test/{id_}")
async def get_test_(id_: str) -> TestResponse | None:
    return await get_test(id_=id_)


@router.post("/api/v1/test/")
async def add_email_paste_parsing_info_(
    data: TestRequest, operator_id: int = Header(include_in_schema=False)
) -> TestResponse:
    return await add_email_paste_parsing_info(data, operator_id)
pli
  • 1
  • 1
  • To make your question more complete, it's probably worth posting the first 30 or so lines of `router/test.py`. – paxdiablo Jul 11 '23 at 23:45
  • @paxdiablo Add the test.py file contents based on your comments. – pli Jul 12 '23 at 00:33
  • pli, the intent of that was so that we could see the exact lines that caused the issue, such as the int/int/str/str on lines 21-24. The way you've given us the code appears to be cut down (with `...` presumably indicating missing lines) and no four-line sequence with those type hints. Suggest adding the first 25v lines exactly as they are. This will help us help you :-) – paxdiablo Jul 12 '23 at 01:55
  • @paxdiable First, I would like to apologize for the unfriendly data. There are bits of code that have been left out that I don't want to make public. addtion explanation. In addition to that `test.py` file, I'm getting the above error in all `*.py` files. All of the int, str, etc. types in the parameters are being logged in the error log. – pli Jul 12 '23 at 04:16
  • Additionally, I tried reinstalling poetry and reinstalling python. – pli Jul 12 '23 at 04:17

0 Answers0