[Type Hinting] _log function is not properly annotated
Steps to Reproduce
- Create a
test.pylike:
import asyncio
import telegram
bot = telegram.Bot(token="some-token")
async def send_msg():
await bot.send_message(chat_id="channel-id", text="Hello World") # Argument missing for parameter "self"
asyncio.run(send_msg())
- Run
pyright test.py
You'll see:
test.py:6:11 - error: Argument missing for parameter "self" (reportGeneralTypeIssues)
Fix is described in pyright discussion, see https://github.com/microsoft/pyright/discussions/6669#discussioncomment-7781395
Expected behaviour
Code is properly annotated so pyright doesn't throw any error.
Actual behaviour
Pyright complains Argument missing for parameter "self"
Operating System
Ubuntu 23.10
Version of Python, python-telegram-bot & dependencies
python-telegram-bot 20.7
Bot API 6.9
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0]
Relevant log output
No response
Additional Context
No response
Thanks for reaching out. This is in fact not the first time we had issues with the typing for this decorator, as it came up in #2677 before, which was adressed in #2686. I strongly suggest that we manually check compatability of a new fix with VSCode and PyCharm before merging.
It would also be good to use this chance to fix & improve our type completeness check as we discovered through this issue that it apparently fails silently.
It would be good to see if this check can automatically detect this shortcoming with a newer version of pyright. If it does not, we should reach out to pyright and ask for clarification.
Edit: The failing check is working again (see #4035) but does not report the issue.