Skip to content

Move defaults to ext #2648

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

Merged
merged 37 commits into from
Oct 3, 2021
Merged

Move defaults to ext #2648

merged 37 commits into from
Oct 3, 2021

Conversation

Bibo-Joshi
Copy link
Member

closes #2346

Mostly as discussed in the dev chat. Two things to emphasize:

  • I couldn't think of a cleaner way of making Message._quote work, especially without directly accessing bot.defaults in Message

  • Bot._insert_defaults_for_ilq_results could theoretically be moved into Bot._insert_defaults, but then we'd have to

    1. iterate over the dict-representation of the InlineQueryResult* (which is more error prone than just accesing the attributes)
    2. if there is a DefaultValue(obj) instance, replace it with the default value or obj
    3. Then check if the new value is None and if it is, delete the key from the dict

    Because of this it seemed a little cleaner to me to keep Bot._insert_defaults_for_ilq_results

  • It's not really the job of Bot._post to convert datetime -> timestamp. Putting it there allows for ExtBot to easily override the behavior without having to override all the methods that accept a datetime. An alternative would be to introduce a Bot._dtm_to_timestamp method that we call in the methods and that ExtBot can override

Checklist for PRs

  • Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests

Bibo-Joshi and others added 16 commits August 11, 2021 08:44
…ryptionError (#2621)

* move telegramdecryptionerror to error.py

* Change error class name
* feat: add docs about docs

* fix: improve looks

* fix: make link work

* fix: this looks better

* Improved markdown, updated link

* Less justifying

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Fix incomplete type annotations for CallbackContext

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
* Feat: Custom pytest marker

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Make basepersistence methods abstractmethod

Signed-off-by: starry69 <starry369126@outlook.com>

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
@Bibo-Joshi Bibo-Joshi added 🛠 refactor change type: refactor 🛠 breaking change type: breaking labels Sep 3, 2021
@Bibo-Joshi Bibo-Joshi added this to the v14 milestone Sep 3, 2021
@Bibo-Joshi Bibo-Joshi mentioned this pull request Sep 3, 2021
22 tasks
Bibo-Joshi and others added 5 commits September 4, 2021 14:41
# Conflicts:
#	telegram/bot.py
#	telegram/ext/callbackqueryhandler.py
#	telegram/ext/chatmemberhandler.py
#	telegram/ext/choseninlineresulthandler.py
#	telegram/ext/commandhandler.py
#	telegram/ext/dispatcher.py
#	telegram/ext/handler.py
#	telegram/ext/inlinequeryhandler.py
#	telegram/ext/jobqueue.py
#	telegram/ext/messagehandler.py
#	telegram/ext/pollanswerhandler.py
#	telegram/ext/pollhandler.py
#	telegram/ext/precheckoutqueryhandler.py
#	telegram/ext/shippingqueryhandler.py
#	telegram/ext/stringcommandhandler.py
#	telegram/ext/stringregexhandler.py
#	telegram/ext/typehandler.py
…ryptionError (#2621)

* move telegramdecryptionerror to error.py

* Change error class name
* feat: add docs about docs

* fix: improve looks

* fix: make link work

* fix: this looks better

* Improved markdown, updated link

* Less justifying

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Fix incomplete type annotations for CallbackContext

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Poolitzer and others added 8 commits September 9, 2021 07:51
* Feat: Custom pytest marker

Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
* Make basepersistence methods abstractmethod

Signed-off-by: starry69 <starry369126@outlook.com>

Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
# Conflicts:
#	telegram/bot.py
#	telegram/ext/dispatcher.py
#	telegram/ext/extbot.py
#	telegram/ext/jobqueue.py
#	tests/conftest.py
# Conflicts:
#	telegram/bot.py
#	telegram/ext/dispatcher.py
#	telegram/ext/extbot.py
#	telegram/ext/jobqueue.py
#	tests/conftest.py
#	tests/test_bot.py
# Conflicts:
#	telegram/bot.py
#	telegram/ext/dispatcher.py
#	telegram/ext/extbot.py
#	tests/test_bot.py
Copy link
Member

@Poolitzer Poolitzer left a comment

Choose a reason for hiding this comment

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

Yes, the changes look good to me as well. Gonna merge.

@Poolitzer Poolitzer merged commit 263b472 into v14 Oct 3, 2021
@Bibo-Joshi Bibo-Joshi deleted the move-defaults-to-ext branch October 3, 2021 13:10
Bibo-Joshi added a commit that referenced this pull request Oct 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛠 breaking change type: breaking 🛠 refactor change type: refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants