- Notifications
You must be signed in to change notification settings - Fork5.7k
Widen specified type forallowed_updates
Application/Updater parameter#4589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This parameter has been inconsistently typed as either list[str] ortuple[str] - as either is acceptable, we can widen the type toSequence[str] to satisfy `mypy` and/or other type checkers.This will allow for constructs like:```Pythonapplication.run_polling( allowed_updates=( UpdateType.MESSAGE, UpdateType.EDITED_MESSAGE, ))```which currently fails mypy (and likely other typecheckers) with an errorlike:`error: Argument "allowed_updates" to "run_polling" of "Application" hasincompatible type "tuple[UpdateType, UpdateType]"; expected "list[str] | None" [arg-type]`
Uh oh!
There was an error while loading.Please reload this page.
looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the fix!
eda2172
intopython-telegram-bot:masterUh oh!
There was an error while loading.Please reload this page.
Thank you for the contribution! |
Uh oh!
There was an error while loading.Please reload this page.
This parameter has been inconsistently typed as either list[str] or tuple[str] - as either is acceptable, we can widen the type to Sequence[str] to satisfy
mypy
and/or other type checkers.This will allow for constructs like:
which currently fails mypy (and likely other typecheckers) with an error like:
error: Argument "allowed_updates" to "run_polling" of "Application" hasincompatible type "tuple[UpdateType, UpdateType]"; expected "list[str] | None" [arg-type]