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

Automatically Resolve Update Types in start_polling method. #1182

Merged
merged 8 commits into from
Jul 17, 2023

Conversation

Latand
Copy link
Contributor

@Latand Latand commented May 23, 2023

Description

Currently, the method dp.resolve_used_update_types can be improved for better readability and understandability, a better name for this function could be "get_registered_event_names", or "get_registered_update_types".

So I changed the logic, that the dispatcher would automatically collect the update types used in handlers, if allowed_updates parameter is not specified.

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples or any documentation update)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@github-actions github-actions bot added the 3.x Issue or PR for stable 3.x version label May 23, 2023
@github-actions
Copy link

github-actions bot commented May 23, 2023

✔️ Changelog found.

Thank you for adding a description of the changes

@@ -450,7 +451,7 @@ async def start_polling(
polling_timeout: int = 10,
handle_as_tasks: bool = True,
backoff_config: BackoffConfig = DEFAULT_BACKOFF_CONFIG,
allowed_updates: Optional[List[str]] = None,
allowed_updates: Optional[List[str]] = UNSET_TYPE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the type hint correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like it replaced UNSET, which is not available in the current version.

@Latand Latand changed the title Add auto_resolve_update_types argument to start_polling method. Automatically Resolve Update Types in start_polling method. Jun 2, 2023
@JrooTJunior JrooTJunior merged commit af4b9cc into aiogram:dev-3.x Jul 17, 2023
2 checks passed
@JrooTJunior
Copy link
Member

Merged outside of this pull-request with small changes in due to incorrect type-hints is used.
fcf9454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issue or PR for stable 3.x version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants