codomposer · GitHub

@codomposer

Copy link Copy Markdown

Contributor

Fixes

Closes #5021

Check-list for PRs

  • Added .. versionadded:: NEXT.VERSION, .. versionchanged:: NEXT.VERSION, .. deprecated:: NEXT.VERSION or ``.. versionremoved:: NEXT.VERSION` to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s
  • Checked the Stability Policy in case of deprecations or changes to documented behavior

If the PR contains API changes (otherwise, you can ignore this passage) - N/A

  • New Classes

    • Added self._id_attrs and corresponding documentation
    • init accepts api_kwargs as keyword-only
  • Added New Shortcuts

    • In telegram.Chat & telegram.User for all methods that accept chat/user_id
    • In telegram.Message for all methods that accept chat_id and message_id
    • For new telegram.Message shortcuts: Added quote argument if methods accept reply_to_message_id
    • In telegram.CallbackQuery for all methods that accept either chat_id and message_id or inline_message_id
  • If Relevant

    • Added new constants at telegram.constants and shortcuts to them as class variables
    • Linked new and existing constants in docstrings instead of hard-coded numbers and strings
    • Added new message types to telegram.Message.effective_attachment
    • Added new handlers for new update types
    • Added new filters for new message (sub)types
    • Added or updated documentation for the changed class(es) and/or method(s)
    • Added the new method(s) to _extbot.py
    • Added or updated bot_methods.rst
    • Updated the Bot API version number in all places: README.rst (including the badge) and telegram.constants.BOT_API_VERSION_INFO
    • Added logic for arbitrary callback data in telegram.ext.ExtBot for new methods that either accept a reply_markup in some form or have a return type that is/contains telegram.Message

Contribution by Gittensor, learn more at https://gittensor.io/

Bibo-Joshi

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

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

Hey, thanks for the PR!
I've left some comments. In addition to that, we'll need new unit tests that cover the changes. If you need some pointers on where to get started, please let me know.

@codomposer

@codomposer

Bibo-Joshi

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

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

Thanks for the updates. I've left some new comments below. Please let me know in case you have any questions on them. In addition

bugfixes = "Fix a Bug in Initialization Logic of ``Bot``"
[[pull_requests]]
uid = "5030"
author_uids = ["codomposer"]
closes_threads = ["5021"]

@codomposer

@codomposer

@codomposer

Copy link Copy Markdown

Contributor Author

@Bibo-Joshi

Copy link Copy Markdown

Member

@codomposer Hey. I will come back to this, when I have the time and mental capacity for it, yes.

Bibo-Joshi

Copy link Copy Markdown

Member

Choose a reason for hiding this comment

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

Hi. I've just 2 small comments open. Thanks very much for the updates and sorry for the delay in review - busy week …

@codomposer

@codomposer

@codomposer

Copy link Copy Markdown

Contributor Author

Hi. I've just 2 small comments open. Thanks very much for the updates and sorry for the delay in review - busy week …

comments addressed, can you please check it? @Bibo-Joshi

@Bibo-Joshi

Copy link Copy Markdown

Member

Hi. Unfortunately, the if-clause is still not correctly covered. Please use pytest-cov locally to compute the coverage and verify that the case is covered. If you need help with that, please reach out. This week, I'm unlikely to have to to dig into that myself …

@codomposer

@codomposer

Copy link Copy Markdown

Contributor Author

Hi. Unfortunately, the if-clause is still not correctly covered. Please use pytest-cov locally to compute the coverage and verify that the case is covered. If you need help with that, please reach out. This week, I'm unlikely to have to to dig into that myself …

@Bibo-Joshi
I've pushed update to cover test_initialize_with_bot_already_initialized_but_not_requests,
can you comment under codeblocks that are missing test coverage if any?
thanks

@Bibo-Joshi

Copy link Copy Markdown

Member

Ah, I see my mistake now: get_me can only be called if the request init already succeeded and only then can _bot_initialized become True. This means that we simply don't need the if not self._bot_initialized check. In the test this shows because you can only catch the current edge case by adapting the internals of Bot, not by mocking the methods called by Bot.init.
TL;DR: please revert your last commit and instead remove the mentioned if-clause. Please excuse the confusion.

…-bot into fix/event_loop

@codomposer

Copy link Copy Markdown

Contributor Author

Ah, I see my mistake now: get_me can only be called if the request init already succeeded and only then can _bot_initialized become True. This means that we simply don't need the if not self._bot_initialized check. In the test this shows because you can only catch the current edge case by adapting the internals of Bot, not by mocking the methods called by Bot.init. TL;DR: please revert your last commit and instead remove the mentioned if-clause. Please excuse the confusion.

done

@Bibo-Joshi

@Bibo-Joshi

@Bibo-Joshi

Copy link Copy Markdown

Member

Thank you very much for your contribution, and also for your patience in the review process! 🙌

Read the original on github.com ↗