-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Default to None for filter func in inline_handler #2501
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
Default to None for filter func in inline_handler #2501
Conversation
2870596 to
dd3626f
Compare
|
types.py had option_ids for the class PollAnswer marked as optional, but they are not. That has been fixed. |
|
types.py is the version taken from the master branch. The only changes are the removal of trailing whitespace and option_ids for the class PollAnswer which were marked as optional when they are not. |
|
Too much changes caused by whitespaces, so too hard to review. Please, tag lines of valuable changes or highlight it in other way to make review possible. |
Co-authored-by: Copilot <[email protected]>
|
line 7405 in types (now corrected, accidentally left the brackets after removing optional) |
I confirm this changes. could you please resolve conflicts and it will be merged. |
|
Resolved. |
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.
Pull Request Overview
This PR sets the default value of the func parameter to None in the inline_handler method for both sync and async versions of the telebot library. Additionally, it includes minor whitespace cleanup in comments and removes trailing blank lines.
- Sets
func=Noneas default parameter ininline_handlermethods - Cleans up documentation formatting and removes extra whitespace
- Updates type annotation for
option_idsto remove Optional wrapper
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| telebot/init.py | Updates inline_handler method signature to default func to None |
| telebot/async_telebot.py | Updates async inline_handler method signature and removes trailing whitespace |
| telebot/types.py | Fixes documentation formatting and updates type annotation for option_ids |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| def __init__(self, poll_id: str, option_ids: List[int], user: Optional[User] = None, voter_chat: Optional[Chat] = None, **kwargs): | ||
| self.poll_id: str = poll_id | ||
| self.user: Optional[User] = user | ||
| self.option_ids: Optional[List[int]] = option_ids | ||
| self.option_ids: List[int] = option_ids |
Copilot
AI
Aug 30, 2025
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.
The type annotation change from Optional[List[int]] to List[int] represents a breaking change to the API. The parameter option_ids can be an empty list when a user retracts their vote (as mentioned in the documentation), but removing the Optional wrapper suggests it can never be None. If None was previously a valid value, this change could break existing code that passes None.
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.
Ignore )
|
Thank you! |
Description
Set func=None as default for the inline handler. and clean up whitespace.
Describe your tests
This should not break anything, it falls in line with the way the other handlers are written to default func to None when no filter is required.
Python version:
3.13
OS:
Ubuntu 24.04
Checklist: