Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect and inconsistent timeout types #3709

Merged

Conversation

revolter
Copy link
Contributor

No description provided.

@Bibo-Joshi
Copy link
Member

Hi. I'm not quite sure what this PR is aiming at. Would you mind explaining where you see inconsistency in the types? IISC we use float everywhere.

@revolter
Copy link
Contributor Author

Yes, sure, sorry for not explaining it from the start.

So, knowing that the official getUpdates API declares timeout as Integer, here are some of the inconsistencies:

  1. The Updater.start_polling correctly declares it as int:

    timeout: int = 10,

    but it's incorrectly documented as float:

    timeout (:obj:`float`, optional): Passed to

  2. The Bot.get_updates incorrectly declares it as float:

    timeout: Optional[float] = None,

    although it's correctly documented as int:

    timeout (:obj:`int`, optional): Timeout in seconds for long polling. Defaults to ``0``,

So, the bottom line is that all of them should be int, which is what this PR does.

@revolter
Copy link
Contributor Author

Let me know if you agree, and I'll rebase and fix the conflicts 👍🏻

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation and the catch! Yes, I would like to have the merged, then :) Would you mind resolving the merge conflicts?

telegram/_bot.py Outdated Show resolved Hide resolved
@revolter
Copy link
Contributor Author

All done 😁

@revolter revolter force-pushed the fix/incorrect-timeout-types branch from d295098 to ed924ff Compare May 19, 2023 19:52
@Bibo-Joshi Bibo-Joshi added API type hinting Not bug. Not Docs. But both. labels May 19, 2023
@Bibo-Joshi Bibo-Joshi merged commit 4f15a7f into python-telegram-bot:master May 19, 2023
23 checks passed
@Bibo-Joshi
Copy link
Member

Than you for the contribution!

@revolter
Copy link
Contributor Author

And thank you for merging!

@revolter revolter deleted the fix/incorrect-timeout-types branch May 19, 2023 20:29
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API type hinting Not bug. Not Docs. But both.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants